Loading a Cygwin based DLL and calling exported functions

Reini Urban rurban@x-ray.at
Wed Dec 8 21:20:00 GMT 2010


2010/12/8 James Dickson:
> 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");

That's a 4byte scratch space on the stack for the char*, and not 4K.

char stackbase[4096]; would fit (untested), but using the padding
method from cygload even better.
-- 
Reini Urban

--
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



More information about the Cygwin mailing list