Re: unresolved external symbol/using an external dll

From: Michael J. Salamone [eMVP] (mikesa#at#entrek#dot#com)
Date: 05/01/04


Date: Fri, 30 Apr 2004 17:13:52 -0700

Actually Windows CE only has cdecl calling convention.

Use dumpbin /exports on the library file. And then dumpbin /relocations on
the .obj file that calls the function.

Most likely you need to have the functions declared with extern "C". You
probably have a problem with name mangling. If so, you would see mangled
names when you dumpbin the .obj file.

-- 
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com
"Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@mvps.org.nospam>
wrote in message news:uHMnVuuLEHA.2576@TK2MSFTNGP12.phx.gbl...
> I suspect that you have a calling convention problem.  The linker of
course
> tells you the complete name of the undefined symbol, what you need to do
is
> dumpbin /exports on the DLL (or dumpbin /symbols on the lib) and find the
> name in the library that you think should match the undefined external.
> Once you have those names, post back with both names and someone can
figure
> out what's wrong (it's probably something like lack of __stdcall on your
> function prototypes).
>
> -cd
>
> Scott Allen wrote:
> > Hello,
> >
> > I'm new to C++ development and I'm trying out figure out the cause of
> > an 'unresolved external symbol' error that I'm receiving when
> > compiling. Here is some history on what I'm doing:
> >
> > I have an existing VC++ project that mostly just reads a SQL Server
> > database does some work on the data and insert the results into
> > another table. I have the need to incorproate some functionality from
> > a certain dll named cedb300.dll. cedb300.dll is an unsupported
> > Microsoft dll that allows the reading and writing of Windows CE
> > databases to a disk (as opposed to an actual device). I have a list of
> > function signatures that are externally available from this dll.
> >
> > I only have access to the dll, so I used a program called 'DLL to Lib'
> > (http://www.binary-soft.com/dll2lib/dll2lib.htm) to generate a .lib
> > file from the dll. This appeared to be successful. I copied both the
> > cedb300.dll and cedb300.lib files into my VC++ project directory and
> > added cedb300.lib to 'Projects->Settings->Link->Object/library
> > modules'
> >
> > I add a call in my VC++ project to one of the functions in
> > cedb300.dll, but when I try to compile I get a 'unresolved external
> > symbol' error message. Naturally, removing the call to the function
> > causes the error to go away and my app compiles.
> >
> > So, being new to VC++, I'm not sure if there's some more code I need
> > to add to my source to allow me to call functions from an external
> > dll, or if VC++ is simply not able to access the .lib files or if the
> > lib file is corrupted, or all of the above.
> >
> > Is there something else I need to add to my code/project to allow me
> > to call functions from an external dll? Or is there another tool
> > someone can recommend to create a lib from a dll?
> >
> > Thanks very much,
> > -Scott
>
>


Relevant Pages

  • Re: unresolved external symbol/using an external dll
    ... Use dumpbin /exports on the library file. ... Most likely you need to have the functions declared with extern "C". ... >> function signatures that are externally available from this dll. ... or if VC++ is simply not able to access the .lib files or if the ...
    (microsoft.public.windowsce.app.development)
  • Re: unresolved external symbol/using an external dll
    ... Use dumpbin /exports on the library file. ... Most likely you need to have the functions declared with extern "C". ... >> function signatures that are externally available from this dll. ... or if VC++ is simply not able to access the .lib files or if the ...
    (microsoft.public.vc.language)
  • Re: PB Generated DLL
    ... do you have any *.DEF file in your DLL project? ... Checked with good old dumpbin and the extern "C" route looks to be producing ... the standard non mangled exports. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: PInvoke a legacy class?
    ... Which parts actually constitute the mangled name DllImport is looking for? ... > or the numeric ordinal - you can use dumpbin or depends to find out this ... > then P/Invoke this from managed code. ... But how do you do that for a legacy dll that is built as a ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Easiest way to do P/Invoke
    ... extern static int MyFunction ... extern "C" __declspecBOOL MyFunction(LPBYTE lpBuffer, ... > managed code and filled by the C DLL, rather than using unmanaged code to ...
    (microsoft.public.dotnet.framework.compactframework)