yaron wrote:
Hi,
I want to use my unmanaged c++ class library from a c# client.
my unmanaged c++ class library use polymorpism, is this polymorphism
also exported to my c# client via PInvoke ?
I'm assuming that you're asking "Can I call a virtual function through a
pointer to a native C++ object via PInvoke?". The answer to that is no (or
at least, not directly). MC++ IJW can, however.
To call virtual functions through PInvoke you'd need to write a little
"trampoline" function and export it from your native DLL. The function
would be a non-member, taking the object pointer and all of the virtual
methods parameters as it's parameters and would perform the virtual function
call.
-cd