-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Description
LLVMContextRef context = LLVMContextRef.Create();
string ir = File.ReadAllText("helper_module.ir");
nint mem = Marshal.StringToHGlobalAnsi(ir);
var memBuf = LLVM.CreateMemoryBufferWithMemoryRangeCopy((sbyte*)mem, (nuint)ir.Length, (sbyte*)Marshal.StringToHGlobalAnsi("helper_module"));
context.TryParseIR(memBuf,out _helperModule,out string msg);
_helperModule.TryVerify(LLVMVerifierFailureAction.LLVMPrintMessageAction, out string message);
var opcodeNewarr = LLVM.GetNamedFunction(_helperModule, (sbyte*)Marshal.StringToHGlobalAnsi("a"));
var to1 = LLVM.TypeOf(opcodeNewarr);
var to1e = LLVM.GetElementType(to1);
ir:
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define i32 @a(){
ret i32 1
}
i am trying to get return type of the function, but getting on var to1e = LLVM.GetElementType(to1);
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
i am using version 16 of llvmsharp
Metadata
Metadata
Assignees
Labels
No labels