From: Julien L. <ju...@fa...> - 2006-06-16 00:14:46
|
On 16/06/2006 01:57, Brian Dessent wrote: > Hugo Leeney wrote: > >> extern "C" __declspec(dllexport) Greeting* exportCreateSalutation() { >> cout<<"about to return Salutation"<<endl; >> return new Salutation(); >> } > > I don't think you can pass pointers to complex C++ objects like this > over 'extern "C"'-defined functions. Try removing that and using the > mangled names in GetProcAddress and see if it's any different. > Actually, Hugo mangled the name up himself ;-) > extern "C" __declspec(dllexport) Greeting* exportCreateSalutation() > extern "C" __declspec(dllexport) void exportDestroySalutation(Greeting* g) > cg = GetProcAddress(lib, "exportCreateGreeting"); > dg = GetProcAddress(lib "exportDestroyGreeting"); Hugo, you create the functions "exportCreate/Destroy" *Salutation* and you try to GetProcAddress on "exportCreate/Destroy" *Greeting*. GetProcAddress thus returns 0, and then segfaults when trying cg->printf(). |