| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT sources DOT redhat DOT com |
| Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
| Message-ID: | <BC36CED13C6AD311BF040008C75D2D5A021E02B1@esekint102.ki.sw.ericsson.se> |
| From: | "Kenneth Sandberg (ERA)" <Kenneth DOT Sandberg AT era DOT ericsson DOT se> |
| To: | "'cygwin AT sourceware DOT cygnus DOT com'" <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) |
| 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 <windows.h>
#include <stdio.h>
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |