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: How to add 4K of scratch space at the bottom of the stack using C instead of C++?


On Mon, 2005-07-11 at 16:14 -0700, Yu-Cheng Chou wrote:
> I used "cl -c main.c" and "cl /o main.exe main.obj" to create main.exe.
> I used "gcc -shared -o module.dll module.c" to create module.dll.
> module.dll will be invoked in main.exe. However, when I run main.exe, the 
> program just hung there.

> So, my question is in an executable program that was created by MSVC, how 
> to dynamically load a library (module.dll) that was created by cygwin's 
> gcc?

If you don't need cygwin functionality, you can just use MinGW
http://www.mingw.org/ and "gcc -mno-cygwin".

> Some users suggested that I load cygwin1.dll before module.dll because 
> module.dll might be related to cygwin1.dll.

> module.dll will only be created by cygwin's gcc, but I'm not sure if I did 
> it in the correct way using "gcc -shared -o module.dll module.c".

You may need to arrange that the symbols are exported; do a "dumpbin
/exports module.dll" and make sure that those things are available.

If your module.dll expects cygwin1.dll to already be present and
initialized, you'll need to arrange for 4K at the bottom of your stack,
then load cygwin1.dll and call cygwin_dll_init(), then load module.dll.

To separate out problems with DLL creation from problems with loading
cygwin, create a cygwin loader application for your DLL first, then
once you have the bugs ironed out of that, create the non-cygwin
version of the loader.



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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