Hi, I apologize for asking the same question that has been asked so many times - but I'm stuck.
I have a DLL built in Cygwin that I'm trying to call from a program compiled in Visual Studio 2012. When I call LoadLibrary it's successful, however calls to the APIs crash the program. >From what I've read, I understand I need to allocate "4k of scratch space at the bottom of the stack" and call the cygwin_dll_init first. (From https://cygwin.com/faq/ section 6.19). I haven't been able to find the how-cygtls-works.txt nor winsup/testsuite/cygload - most of the links in old mail archives are dead (some messages go back to 2007). That said, I've found cygload.cc here: https://raw.githubusercontent.com/openunix/cygwin/master/winsup/testsuite/winsup.api/cygload.cc Here, the code attempts to use some assembly to set the stack size: #ifdef __GNUC__ __asm__ ( "movl %%fs:4, %0" :"=r"(stackbase) ); #else __asm { mov eax, fs:[4]; mov stackbase, eax; } #endif However these lines crash the program. I've downloaded these exact files (the .cc & .h) and compiled them using VS2012. When debugged / run i get an access violation and crash. Note - i'm trying to run this program as is, unmodified. Is there a specific compiler flag i need to set in order to allow these operations? I've turned off DEP, i've tried both set the entry point to be cygloadCRTStartup then going back - reseting the entry point and uncommenting the construction of the padding object line. Both fail. Does anyone happen to have a simple example - simply calling a "fooapi" within a dll available? Is there any updated documentation anywhere? Thanks for the help! mike -- 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