Closed CWKSC closed 1 year ago
If I remove libLLVM and only install LLVMSharp, the error disappear
I fix with removing libLLVM 15.0.0 and only installing LLVMSharp.
The program looks like using libLLVM 5.0.0, It is not normal, so I reopen it.
I guess the problem is related to the creation of a const global string.
I downgrade until libLLVM 14.0.0 and its work
By check out LLVM 15.0.0 ReleaseNotes
Find that LLVM 15.0.0 has some changes of C API, but I don't see anything affecting this, BuildGlobalStringPtr
should be still working
LLVM 15 made some changes in how BuildCall
and friends work. They are "obsolete" now and you should be using BuildCall2
instead. This requires you to pass in the function type explicitly.
I plan on trying to improve this experience more in the future, but it will require a custom C extension library libLLVMSharp
, much as was provided for ClangSharp
. Such a library would "fill the gaps" in the official libLLVM
C bindings exposed by LLVM.
I am an LLVM beginner and trying to transform LLVM C++ API to LLVMSharp in my project (suffering from C++ and CMake)
So I am implementing a HelloWorld example with LLVMSharp for learning, but there are some things wrong
I create a console program with .NET 7 by Visual Studio 2022 Preview
I install LLVMSharp and libLLVM by NuGet, and add
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
into csproj to solveDllNotFoundException
(https://github.com/dotnet/LLVMSharp/issues/157#issuecomment-779942328)With abstruct some utilities function like
CreateExtern
,DeclarePuts
,CreateFunction
,CreateMain
...I create the following program:
Program crashes in
LLVM.BuildCall(builder_main, funcPuts, parameters, "");
, and the console output:By
LLVM.DumpModule(module);
, the halfway result before the crash is as follows: