adding c style dll to c# app

  • Thread starter Thread starter saleh
  • Start date Start date
S

saleh

hi,

i have a dll with its .h file,in the .h i found the [ extern "C" ] .
when i tried to add the dll to a c# app ,it give me that error
[please make sure that it is a valid com or assembly component]

so does anyone could help me to add the .dll to my app.

note: i don't have the source code.

thanks.
 
hi Gary ,

thanks for your reply ,but it solve diifrent problem not mine

my problem is:the VS don't allow me to add reference to the dll from
the start and give me that error.

thanks,
saleh
 
saleh said:
hi,

i have a dll with its .h file,in the .h i found the [ extern "C" ] .
when i tried to add the dll to a c# app ,it give me that error
[please make sure that it is a valid com or assembly component]

so does anyone could help me to add the .dll to my app.

note: i don't have the source code.

thanks.


You can't add a "native code" dll to a C# project, C# cannot statically link to DLL's . If
you need to call "C" style functions exported from DLL's from C#, you'll have to import the
functions using the DllImport attribute. Search MSDN for details on PInvoke and DllImport.

Willy.
 
Back
Top