-
Notifications
You must be signed in to change notification settings - Fork 59
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
Experimental .Net support #371
base: master
Are you sure you want to change the base?
Conversation
@AdamRzepka As your last commit was some time ago, I am curious about what is state of this work. It is just experimental? Or maybe you are able to fill your requirements to a real use and leave at current state? |
@sisso We do use this internally for quite some time and it works fine. The state of missing features (interfaces, callbacks) hasn't changed, as we don't need them. |
@AdamRzepka Giving your experience on this changes. Do you think that have a flag to generate code loading those libraries dynamically too hard? I am amateur in FFI. From what I understand It would require a different life cycle as you need to call "dlopen" to load the library, "dlsym" to get the functions and "dlclose" to dispose the library. Context: I am experimenting using rust with unity3d, flapi-gen solve mostly of problems. But dynamic load is require to be able to apply changes without have to restart the engine. My current implementation with state/dynamic load: https://github.com/sisso/test-unity3d-rust/blob/8b0e95ae6d2230cb164d0262895c3a8d0a15549e/unity3d/Assets/src/Domain/Ffi/Native.cs |
Generating .Net glue code. This time, I had a chance to dive into the typemap system of flapigen and I was able to do this module in more "idiomatic" fashion (in contrast to Python support).
Stability
I still haven't grasp the test framework of flapigen. However, the example
dotnet_tests
project performs basic tests. The module was also tested in our production code with quite bigglue.rs.in
files (6k lines in total). We use exactly the same file to export C++ and Python bindings.How to use it
It generates two artifacts:
dll
(orso
ordylib
), tailored for PInvoke usage. The client application must be able to find this dll at runtime. The simplest way for this is to put it into the same directory asexe
file.csproj
must reference this dll.Take a look at
dotnet_tests
project andtest_dotnet
function inci_build_and_test
to get the idea, how to integrate this into your application.What's missing