Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Mon, 11 Jul 2005 16:14:42 -0700 (PDT) Message-Id: <200507112314.j6BNEgp0014484@lymeon.ucdavis.edu> To: cygwin AT cygwin DOT com Subject: Re: How to add 4K of scratch space at the bottom of the stack using C instead of C++? From: "Yu-Cheng Chou" X-Errors-To: cycchou AT magenta DOT ucdavis DOT edu X-User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322) X-IsSubscribed: yes > > I have module.dll that was created by using command line "gcc -shared > > -o module.dll module.c" in cygwin. > > When I run "msvc-cygload -v -cygwin module.dll" in cygwin, error > > messages listed below occurred. > Why are you using cygload to load something that isn't cygwin1.dll? Hi, Max: Originally, I got two files, main.c and module.c // main.c #include #include int main(){ void *handle; int (*fp)(); char *modname = "./module.dll"; handle = LoadLibrary(modname); if (handle == NULL) { fprintf(stderr, "Can't load %s in LoadLibrary()\n", modname); exit(1); } fp = (int (*)())GetProcAddress((HMODULE)handle, "foo"); if (fp== NULL) { fprintf(stderr, "ERROR: GetProcAddress()\n"); exit(1); } fp(); FreeLibrary((HMODULE)handle); } // module.c #include #include int foo(int arg){ printf("foo() called\n"); return (arg * 2); } 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? 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". I have been working on this for a while, but still can't figure out how to make it work. Could you help me with this? Thanks -- 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/