delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MSGID_FROM_MTA_HEADER |
X-Spam-Check-By: | sourceware.org |
Message-Id: | <201102140403.p1E43cc8002240@omx11.ms.so-net.ne.jp> |
X-DKIM: | Sendmail DKIM Filter v2.8.3 inspiron.cuvie.serveftp.com B120E121436 |
Date: | Mon, 14 Feb 2011 13:03:37 +0900 |
From: | "Y.Hosoi" <mlist AT mail DOT cuvie DOT net> |
To: | cygwin AT cygwin DOT com |
Subject: | Re[2]: I want to use DLL compiled with Cygwin with VC(VS2008). |
In-Reply-To: | <20110212025813.GA20293@ednor.casa.cgf.cx> |
References: | <201102120245 DOT p1C2juUX029959 AT omx12 DOT ms DOT so-net DOT ne DOT jp> <20110212025813 DOT GA20293 AT ednor DOT casa DOT cgf DOT cx> |
X-bkComposeTime: | 00:07:28 |
MIME-Version: | 1.0 |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Thank you. However, it did not move well. If test.dll is done in LoadLibrary, Access Violation is generated. Are you still amused something? [main source code] #include "stdafx.h" #include "windows.h" #ifdef __cplusplus extern "C"{ #endif typedef int (*TFUNC)(void); typedef void (*Tinit)(void); int _tmain(int argc, _TCHAR* argv[]) { int i; HINSTANCE h; HINSTANCE hInstDLL; Tinit init; TFUNC DllFunction; DWORD ErrNo; h = LoadLibrary( TEXT( "cygwin1.dll" ) ); init = (Tinit)GetProcAddress( h, "cygwin_dll_init" ); init(); hInstDLL = LoadLibrary( TEXT( "test.dll" ) ); /* !Access Violation! */ if( hInstDLL == NULL ) { ErrNo = GetLastError(); return 0; } DllFunction = (TFUNC)GetProcAddress( hInstDLL, "hello" ); i = DllFunction(); FreeLibrary( hInstDLL ); FreeLibrary( h ); return 0; } #ifdef __cplusplus } #endif -- Y.Hosoi <mlist AT mail DOT cuvie DOT net> -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |