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 From: "Bill Grigg" To: "Larry Hall \(RFK Partners, Inc\)" , Subject: RE: dlltool & link to VC++ generated DLL Date: Wed, 18 Apr 2001 07:07:17 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 In-reply-to: <4.3.1.2.20010417172435.0220f3f0@pop.ma.ultranet.com> Importance: Normal Larry, thanks again for your response. All the entry points in the dll are declared with "__declspec(dllexport)". The calling convention used is "__stdcall". All of this works just dandy when I call them from my VB app. However, in the declaration portion of the VB app I need to tell VB that the function names are "aliased" by doing the following: Private Declare Function Get_Status_Nav Lib "E:\NWVPAD\MYDLL" Alias "_Get_Status_Nav AT 4" (ByRef msg As NAV_STAT_MSG) As Integer They are declared in App2 in the following way: extern Get_Status_Nav (struct NAV_STAT_MSG* m); extern Set_Status_Nav (struct NAV_STAT_MSG* m); Maybe I need the "__declspec(import)" in front of them?: extern __declspec(import) Get_Status_Nav (struct NAV_STAT_MSG* m); extern __declspec(import) Set_Status_Nav (struct NAV_STAT_MSG* m); Since I last talked to you I did verify that "debug" versus "release" has nothing to do with it. If I ever get thru this, I will let you know what did it. Thanks again, and feel free to offer any more suggestions that occur to you, Bill Grigg -----Original Message----- From: Larry Hall (RFK Partners, Inc) [mailto:lhall AT rfk DOT com] Sent: Tuesday, April 17, 2001 5:32 PM To: Bill Grigg Subject: RE: dlltool & link to VC++ generated DLL Stripped means that the symbols have been stripped out. Release mode of VC++ may be doing this. Debug should not. Still, I have seen others generate .defs from release DLLs so there must be a way. Certainly, your approach of using the .LIB is one. You need to check the failing symbol make says it wants against those in your .def file. My guess is there is still some difference in what being asked for and what you have. This may very well be that Set_Status_Nav and Get_Status_Nav are not declared properly, so the caller doesn't generate the right calling convention to match the DLL/LIB. If the names look different in the DLL and the failed link line, this is the problem. Make sure the symbols are declared __declspec(import) and __declspec(export). Larry At 04:16 PM 4/17/2001, Bill Grigg wrote: >Larry, thank you very much for your response. I took your advice and built >the .def from the command line. I guess my dll must have been "stripped", >because I did get the error message about "No symbols in foo.dll". What does >"stripped" mean? When I do the build in VC++ I use the "release" option >instead of the "debug" option. Would that be relevant? In any event, I >changed the "nm" command line to use MYDLL.lib instead of MYDLL.dll. This >produces a .def file loaded with entry points, and permits the next command >line, "dlltool ...", to build a MYDLL.a. Unhappily, when I run the makefile >it now cannot find my entry points when it tries to link with MYDLL.a. At >least this is different than before.... > >Any more thoughts? > >TIA > >Bill Grigg > >-----Original Message----- >From: Larry Hall (RFK Partners, Inc) [mailto:lhall AT rfk DOT com] >Sent: Tuesday, April 17, 2001 2:43 PM >To: Bill Grigg; cygwin AT cygwin DOT com >Subject: Re: dlltool & link to VC++ generated DLL > > > >At 02:00 PM 4/17/2001, Bill Grigg wrote: > > > > > > > > >Linking Against DLLs > >If you have an existing DLL already, you need to build a Cygwin-compatible > >import library (The supplied ones should work, but you might not have them) > >to link against. Unfortunately, there is not yet any tool to do this > >automatically. However, you can get most of the way by creating a .def file > >with these commands (you might need to do this in bash for the quoting to > >work correctly): > >echo EXPORTS > foo.defnm foo.dll | grep ' T _' | sed 's/.* T _//' >> >foo.def > >Note that this will only work if the DLL is not stripped. Otherwise you >will > >get an error message: "No symbols in foo.dll". > >Once you have the .def file, you can create an import library from it like > >this: > >dlltool --def foo.def --dllname foo.dll --output-lib foo.a > > > > > >7. I skipped the "echo EXPORTS ..." part and just built my own .def file, > >MYDLL.def. See below: > > >You shouldn't do this. My guess is that you now have the wrong function >name due to improper calling convention. Fix this or do the step you >skipped. > > > >LIBRARY MYDLL > > > >EXPORTS > > Set_Status_Nav > > Get_Status_Nav > > > > >Larry Hall lhall AT rfk DOT com >RFK Partners, Inc. http://www.rfk.com >118 Washington Street (508) 893-9779 - RFK Office >Holliston, MA 01746 (508) 893-9889 - FAX -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple