Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: From: "Kenneth Sandberg (ERA)" To: "'cygwin AT sourceware DOT cygnus DOT com'" Subject: Problems using a DLL created with GNU from Microsoft VC++ Date: Tue, 8 Aug 2000 17:54:26 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2651.58) Content-Type: text/plain; charset="iso-8859-1" X-OriginalArrivalTime: 08 Aug 2000 15:54:47.0003 (UTC) FILETIME=[FA0532B0:01C00150] I am trying to use a DLL created with cygwin g++ from an application created with Microsoft Visual C++. The reason is that I have C-code (huge) that is created for GNU and would like to use it in an application that requires Microsoft Visual C++. This is what I have done: - I started with the example described in http://sources.redhat.com/cygwin/building-reloc-dlls.txt. - I changed the main-file to load the DLL: // Main file to try linking with a DLL under GNUwin32 #include #include typedef int (*doit)(int); typedef int (*doittoo)(int); int main() { HINSTANCE hinstLib; doit doitPROC; doittoo doittooPROC; int x; printf("main3.c\n"); //--- LOAD LIB --- hinstLib = LoadLibrary("fooB.dll"); if (hinstLib == NULL) { printf("Error loading DLL!\n"); exit(0); } //--- LOCATE FUNCTIONS --- doitPROC = (doit)GetProcAddress(hinstLib,"doit__Fi"); if (doitPROC == NULL) { printf("Can't locate doit()!\n"); exit(0); } doittooPROC = (doittoo)GetProcAddress(hinstLib,"doittoo__Fi"); if (doittooPROC == NULL) { printf("Can't locate doittoo()!\n"); exit(0); } x = (doitPROC)(5); printf("doit(5) returns %d\n",x); x = (doittooPROC)(5); printf("doittoo(5) returns %d\n",x); } - Compiled the code above with g++ main3.c -o main3.exe. This works fine! Same result as before. - Compiled the code with Microsoft Visual C++ (unchanged). It compiles OK but it doesn't work. The message "Unhandled exception in main3.exe (NTDLL.DLL): 0xC000005: Access Violation." shows up. The Call Stack looks like this: NTDLL! 77f6cde6() NTDLL! 77f67506() CYGWIN1! 6101edff() CYGWIN1! 61047a6e() CYGWIN1! 61077304() CYGWIN1! 610774bb() CYGWIN1! 61073560() CYGWIN1! 6106f684() FOOB! 1000102b() main() line 38 + 7 bytes mainCRTStartup() line 206 + 25 bytes KERNEL32! 77f1ba3c() I am running cygwin (latest release, I made a fresh install this morning) with Windows NT 4. Any suggestions? / Kenneth Sandberg (Kenneth DOT Sandberg AT era DOT ericsson DOT se) -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com