This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Loading a Cygwin based DLL and calling exported functions


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]