Sign in to follow this  
Khaos Dragon

novodex wrapper for c#

Recommended Posts

I was wondering how I would go about making novodex useable in c# and wanted to know if the following sequence of steps is on the right track. 1) write a c++.net wrapper around the unmanaged novodex library 2) compile the wrapper into a dll 3) from within c# use pinvokes to load and run the wrapper functions from the dll

Share this post


Link to post
Share on other sites
If you write a managed class around Novodex you would not use PInvoke from your own code anymore. You would simply add the dll as a reference and then treat the managed classes inside like normal managed classes. You only need to use PInvoke to call out into non-managed code.

Share this post


Link to post
Share on other sites
Ok now that is good to know.
Now do I need to wrap each every novodex function I use or could I combine them. Let's say hypothetically I managed to put all my physics related code in 3 functions.

InitializeNovodex()
RunNovodex( float timeSlice)
FreeNovodex()

Could I merely wrap these 3 functions and then call them directly from the resultant dll in c#?

Share this post


Link to post
Share on other sites
Yes, you can wrap them however you want to, only the functions you want to call from the managed portion of your program need to be declared in the wrapper. If you do a full porting of the code to managed though, be sure to let people know. A lot of people will probably find that useful.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this