C Library in a managed DLL

K

Kidan

I have a .LIB file, built an compiled in C that I need to use in
my .NET application.

If I build a C++.Net Console application and activate the exposed
functions directly the library works perfectly.

If I try to compile the .LIB file into a managed DLL for use in either
my VB.Net GUI or my managed C++.Net Console application I get a Null
Reference Exception when the LIB makes a MALLOC call.

Is there some command or option that I need to set to allow my managed
DLL to be able to run MALLOC?

Thanks!
 
G

Guest

Hi Kidan,

Have you tried to access the library via platform invoke instead of
importing it ?

something like this:

Declaration:
-------------

<DllImport("filename.(lib or dll)", EntryPoint:="YourREALFunctionName")> _
Private Shared Function YourAliasForyourfunction(parameter1 as
parametertype, etc.) As ReturnValueType
End Function--

Using it:
---------

VariableWithReturnType=YourAliasForyourfunction(parameters) ...


I hope this helps,

Roger
..NET 2005 and DB developer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top