Click to See Complete Forum and Search --> : How to call DLL compiled by VC 6.0 by C#?


qiongwen
March 12th, 2002, 01:49 AM
I have a DLL which was compiled with VC 6.0.
Can I call that DLL with C#?
Thanks!

vmister
March 12th, 2002, 01:56 AM
You must include in your project System.Runtime.InteropServices.

Sample:

[DllImport("yourDll")]
public static extern int Function(int hWnd,....)

public static int Main()
{
Function(10);
}




Can you retrieve on MSDM documentation about Platform Invoke.

Good luck
Please rate if you think this response was useful for you.
Have more questions?

xucaen
July 2nd, 2003, 11:48 AM
Hi all. I am trying to import a c++ dll, but the compiler doesn't understand the user defined c++ data types being passed into and returned from the c++ function. How do I import user defined c++ data types?

for example:

[DllImport("myvsdll.dll")]
static extern USERTYPE* process(USERDATA* udata);


compiler says USERTYPE and USERDATA can not be found.

Thanks!