Calling methods of a class in a Win32 Dll

Jan 14 2005 9:05 AM
I know that you can call functions of a Win32 library from C#. So if you have the following function: void Foo(unsigned short msg, unsigned int param); You can write in C# the following P/Invoke code: [DllImport("whatever.dll", CharSet=CharSet.Auto, SetLastError=true)] public static extern uint Foo(ushort messge, uint param); The problem is, how can I call methods of an exported class inside a Win32 Library, for example: class Foo { public: void Method1() { /* ... */ } }; Thanks in advance.

Answers (4)