public void EmitToFile(LLVMModuleRef module, string fileName, LLVMCodeGenFileType codegen) { if (!TryEmitToFile(module, fileName, codegen, out string Error)) { throw new ExternalException(Error); } }
public static void EmitModule(LLVMExecutionEngineRef ee, LLVMModuleRef mod, LLVMCodeGenFileType fileType, string filename) { IntPtr error; IntPtr ptr = Marshal.StringToHGlobalAnsi(filename); LLVM.TargetMachineEmitToFile(LLVM.GetExecutionEngineTargetMachine(ee), mod, ptr, fileType, out error); Console.WriteLine(StringifyMessage(error)); }
public MemoryBuffer EmitToMemoryBuffer(Module m, LLVMCodeGenFileType codegen) { if (LLVM.TargetMachineEmitToMemoryBuffer(this.Unwrap(), m.Unwrap(), codegen, out IntPtr error, out LLVMMemoryBufferRef buf).Failed()) { TextUtilities.Throw(error); } return(buf.Wrap()); }
public bool TryEmitToFile(LLVMModuleRef module, string fileName, LLVMCodeGenFileType codegen, out string message) { using var marshaledFileName = new MarshaledString(fileName); sbyte *errorMessage; int result = LLVM.TargetMachineEmitToFile(this, module, marshaledFileName, codegen, &errorMessage); if (errorMessage is null) { message = string.Empty; } else { var span = new ReadOnlySpan <byte>(errorMessage, int.MaxValue); message = span.Slice(0, span.IndexOf((byte)'\0')).AsString(); LLVM.DisposeErrorMessage(errorMessage); } return(result == 0); }
public static extern int TargetMachineEmitToFile(LLVMTargetMachineRef* T, LLVMModuleRef* M, [In][MarshalAs(UnmanagedType.LPStr)] string Filename, LLVMCodeGenFileType codegen, [MarshalAs(UnmanagedType.LPStr)] ref StringBuilder ErrorMessage);
public static LLVMBool TargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef T, LLVMModuleRef M, LLVMCodeGenFileType codegen, out string ErrorMessage, out LLVMMemoryBufferRef OutMemBuf) { var retVal = TargetMachineEmitToMemoryBuffer(T, M, codegen, out IntPtr message, out OutMemBuf); ErrorMessage = message != IntPtr.Zero && retVal.Value != 0 ? Marshal.PtrToStringAnsi(message) : null; DisposeMessage(message); return(retVal); }
public static LLVMBool TargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M, IntPtr Filename, LLVMCodeGenFileType codegen, out string ErrorMessage) { var retVal = TargetMachineEmitToFile(T, M, Filename, codegen, out IntPtr message); ErrorMessage = message != IntPtr.Zero && retVal.Value != 0 ? Marshal.PtrToStringAnsi(message) : null; DisposeMessage(message); return(retVal); }
public static extern LLVMBool TargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef @T, LLVMModuleRef @M, LLVMCodeGenFileType @codegen, out IntPtr @ErrorMessage, out LLVMMemoryBufferRef @OutMemBuf);
public static extern LLVMBool TargetMachineEmitToFile(LLVMTargetMachineRef @T, LLVMModuleRef @M, IntPtr @Filename, LLVMCodeGenFileType @codegen, out IntPtr @ErrorMessage);
public bool EmitToFile(Module m, IntPtr filename, LLVMCodeGenFileType codegen, out IntPtr errorMessage) => LLVM.TargetMachineEmitToFile(this.Unwrap(), m.Unwrap(), filename, codegen, out errorMessage);
public static extern LLVMBool TargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M, IntPtr Filename, LLVMCodeGenFileType codegen, out IntPtr ErrorMessage);
public bool TryEmitToFile(LLVMModuleRef module, string fileName, LLVMCodeGenFileType codegen, out string message) => TryEmitToFile(module, fileName.AsSpan(), codegen, out message);
public void EmitToFile(LLVMModuleRef module, string fileName, LLVMCodeGenFileType codegen) => EmitToFile(module, fileName.AsSpan(), codegen);