This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: dlltool & link to VC++ generated DLL


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@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@rfk.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@rfk.com]
>Sent: Tuesday, April 17, 2001 2:43 PM
>To: Bill Grigg; cygwin@cygwin.com
>Subject: Re: dlltool & link to VC++ generated DLL
>
>
>
>At 02:00 PM 4/17/2001, Bill Grigg wrote:
>
> ><snip>
>
>
>
>
> >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@rfk.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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]