Hey, I just posted (apologies if I have the wrong mailing list) to see if anyone could help me with the following problem.
I have successfully managed to load a cygwin based DLL through LoadLibrary into a VC++ 10.0 (as an aside I have also tried 8.0 and 9.0 compiler versions) compiled application, ensuring I have 4k of scratch space as per FAQ 6.16 and the example http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/testsuite/cygload/Attic/cygload.cc?cvsroot=src. However, if I then proceed to call any function internal or exported from the DLL which makes stack allocations through local variables, the application hangs\crashes. I hope the below example is sufficient to demonstrate the problem and no amount of googling seems to yield the answer, that or I haven't found the right combination of search words. VC++ 10.0 client application: int main(int argc, char ** argv) { // 4k scratch space. char *stackbase; __asm { mov eax, fs:[4]; mov stackbase, eax; } // Load cygwin dll. HMODULE cygwin_ptr = LoadLibrary(L"cygwin1.dll"); // error checks omitted.... init_ptr init = (init_ptr)GetProcAddress(cygwin_ptr, "cygwin_dll_init"); // error checks omitted.... init(); // Load plugin HMODULE plugin_ptr = LoadLibrary(L"plugin.dll"); // error checks omitted.... plugin_ptr exp_test = (plugin_ptr)GetProcAddress(plugin_ptr, "plugin_example"); // error checks omitted.... exp_test(); // This call hangs the application. } Cygwin based DLL: extern "C" __declspec(dllexport) void plugin_example(void) { std::wstring tmp(L"some string"); // This for some reason causes the application to hang. std::wcerr << tmp << std::endl; } I have found I can make it work sometimes, but when I start using more stack allocated local variables the hanging reoccurs. Am I missing something simple? I really hope so. Thank you for any help you can give me. -- James Dickson -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple