Re: Name decoration Problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: John Phillips (jjphillipsREMOVE_at_REMOVEhotmail.com)
Date: 03/02/04


Date: Tue, 2 Mar 2004 14:34:17 -0500

Yes, check out the documentation for /DEFAULTLIB (here I'm assuming you're
compiling the sample from the command line).

Or, in your code, you can do something like this:

#pragma comment(linker, "/defaultlib:MyDLL.lib")

--
John Phillips
MVP - Windows SDK
"Michael Pierce" <Michael.Pierce@_RE_MOVE_tentechnologies.com> wrote in
message news:hI41c.107259$n62.3619@twister.nyroc.rr.com...
> No.  I placed a copy of the .h file, and the *.dll file in
> "C:\DDK\WINDDK\2600.1106\src\print\oemdll\CST_watermark_NT\wmarkps".
Should
> I be linking with the .lib file?  If so, how is that done?
>
> "John Phillips" <jjphillipsREMOVE@REMOVEhotmail.com> wrote in message
> news:u0CYszHAEHA.2180@TK2MSFTNGP09.phx.gbl...
> > Are you linking with the DLL's .lib file?
> >
> > --
> > John Phillips
> > MVP - Windows SDK
> >
> >
> > "Michael Pierce" <Michael.Pierce@_RE_MOVE_tentechnologies.com> wrote in
> > message news:uD21c.105790$n62.60898@twister.nyroc.rr.com...
> > > I am having a problem with name decoration.  I have a Win32 DLL with
one
> > > exported function and the pertinent code pieces are:
> > >
> > >
> > >
> > > *.def file
> > >
> > > Exports
> > >
> > >     GenerateJobID
> > >
> > >
> > >
> > >
> > >
> > > *.h file
> > >
> > > #ifdef __cplusplus
> > >
> > > extern "C" {
> > >
> > > #endif  /* __cplusplus */
> > >
> > >
> > >
> > >                 __declspec( dllexport ) WCHAR * GenerateJobID();
> > >
> > >
> > >
> > > #ifdef __cplusplus
> > >
> > > }
> > >
> > > #endif
> > >
> > >
> > >
> > >
> > >
> > > *.cpp file
> > >
> > > WCHAR * GenerateJobID()
> > >
> > > {
> > >
> > > /*****/
> > >
> > > }
> > >
> > >
> > >
> > >
> > >
> > > When viewing the *.lib file I see "__imp__GenerateJobID", which I
> believe
> > is
> > > correct.
> > >
> > >
> > >
> > > I want to now import this method into a DDK sample
> > >
> >
>
(C:\DDK\WINDDK\2600.1106\src\print\oemdll\CST_watermark_NT\wmarkps\command.c
> > > pp).
> > >
> > >
> > >
> > > Command.cpp has the following code pieces:
> > >
> > > #include "TenApi.h"
> > >
> > > .
> > >
> > > extern "C" {
> > >
> > >       __declspec( dllimport ) WCHAR * GenerateJobID();
> > >
> > > }
> > >
> > >
> > >
> > > .
> > >
> > > void foo()
> > >
> > > {
> > >
> > >       WCHAR * wszTemp;
> > >
> > >       wszTemp = GenerateJobID();
> > >
> > > }
> > >
> > >
> > >
> > > When I compile I get the following error: "unresolved external symbol
> > > __imp__GenerateJobID@0 referenced in function "void __stdcall
foo(void)"
> > > (?foo@@YGXXZ)"
> > >
> > >
> > >
> > > If I extern "C" function foo(), I get the following error:
"unresolved
> > > external symbol __imp__GenerateJobID@0 referenced in function _foo@0"
> > >
> > >
> > >
> > > Any idea what I am doing wrong?
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Linking with a static library
    ... I use Visual C++ to build all my drivers - much easier ... start linking in static libraries, ...
    (microsoft.public.development.device.drivers)
  • Re: static dll linking
    ... A DLL, by definition, uses only dynamic linking. ... you need a lib file; Delphi neither generates nor uses lib files. ... But load-time dynamic linking is also called "static linking", ...
    (alt.comp.lang.borland-delphi)
  • Re: Using LIB Files in Delphi
    ... LIB file. ... Linking with C-derived object modules/libraries is something that I have, ... The utility coff2omf supposedly will convert LIBs to OMF. ...
    (comp.lang.pascal.delphi.misc)
  • Re: all references to "User32.dll" discarded by /OPT:REF
    ... Because you are including the .LIB file for this in your project but when ... the actual linking comes, it doesn't find any functions contained in ... > Why do I get this error message in Masm32? ...
    (alt.lang.asm)
  • Re: KMDF and EXPORT_DRIVER
    ... Signature of the called function and exported function was differenet. ... I am trying to build a KMDF PNP driver as a EXPORT_DRIVER. ... I can even see the exported functions in the .sys file. ... But when i try to link the generated .lib file with other non-pnp KMDF ...
    (microsoft.public.development.device.drivers)