This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Loading a Cygwin based DLL and calling exported functions
- From: Reini Urban <rurban at x-ray dot at>
- To: cygwin at cygwin dot com
- Date: Wed, 8 Dec 2010 22:20:26 +0100
- Subject: Re: Loading a Cygwin based DLL and calling exported functions
- References: <AANLkTim2j17e_BiNicdwqyeSaGxxm7Ok6OX5oXpvbNGA@mail.gmail.com> <AANLkTikJmOf7hrrXGveCPtjZanYXCd8VDnUdfNkBPiKM@mail.gmail.com>
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