Discussion in 'OT Technology' started by misha, Mar 21, 2007.
So what's your motivation here. Do you have some C code you want to use in .NET? Any specific reason why you can't port the code to C# (too much work, not your code etc?).
Port it to C# I recommend, otherwise you need to research COM Interop if porting isn't viable for any reason.
Also, are you able to compile a dll of the C code currently or you need help with that too?
if you can manage to make the c dll com compliant. idk shit about doing that in c, i know you need to implement IUnkown (addRef, releaseRef, and 1 other), but i am not sure how to go about that outside of mfc. Anyway if it is com enabled then all you would do is add it as a reference to your .net assembly and the vs ide will create an interop wrapper dll that will allow you to use it from the managed code.
One option is to use platform invoke, or declares for vb.net
The other thing to look at is the [DLLImports] attribute if the c class is configured for that
it is not my code. will the c code work directly in c#? meaning can I just paste it into a class?