-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement missing apis #112
Conversation
return span.Slice(0, span.IndexOf((byte)'\0')).AsString(); | ||
} | ||
|
||
public bool EmitToFile(LLVMModuleRef module, string fileName, LLVMCodeGenFileType codegen, out string message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This should be TryEmitToFile
and there should optionally be a corresponding string EmitToFile
which throws on failure (this follows the .NET Framework design guidelines).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tannergooding Thanks fixed
{ | ||
sbyte* pMessage; | ||
|
||
int result = LLVM.TargetMachineEmitToFile(this, module, marshaledFileName, codegen, &pMessage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the docs, we need to call LLVMDisposeMessage
on errorMessage
after marshaling it to managed code. It would probably be good to explicitly call it errorMessage
as well, so it is clear to the consumer its intent.
Otherwise, the changes LGTM. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tannergooding thanks fixed
Thanks! |
missing apis while porting some of my code from https://www.nuget.org/packages/swigged.llvm/
to LLVMSharp v8