trouble with .lib file export - class exported, but not as expected.

Discussion in 'C++' started by acc13, Jul 31, 2006.

  1. acc13

    acc13 Guest

    I have written a .dll that exports a class MyClass, which has a member
    function MyFunction(LPCWSTR szMyString).

    If I build (I'm using VC7) with the /showIncludes option, I can see
    that LPCWSTR is defined in file ...\platformsdk\include\winnt.h as:

    typedef __nullterminated CONST WCHAR *LPCWSTR, *PCWSTR;

    and WCHAR is in turn defined as:

    #ifndef _MAC
    typedef wchar_t WCHAR; // wc, 16-bit UNICODE character
    #else
    // some Macintosh compilers don't define wchar_t in a convenient
    location, or define it as a char
    typedef unsigned short WCHAR; // wc, 16-bit UNICODE character
    #endif

    I have (obviously) not defined _MAC (I even verified that no rogue
    include did so by testing "#ifdef _MAC\n#error _MAC defined!\n#endif),
    so I expect the .lib file to export the function

    long __thiscall MyClass::MyFunction(wchar_t const *)

    Instead the output from dumpbin shows that my lib file exports the
    function,

    long __thiscall MyClass::MyFunction(unsigned short const *)

    and my test dll client program builds with a LNK2019 unresolved
    external symbol.
    What's the deal?
    Thanks in advance for any help on the matter...
     
    acc13, Jul 31, 2006
    #1
    1. Advertising

  2. acc13

    mlimber Guest

    acc13 wrote:
    > I have written a .dll that exports a class MyClass, which has a member
    > function MyFunction(LPCWSTR szMyString).
    >
    > If I build (I'm using VC7) with the /showIncludes option, I can see
    > that LPCWSTR is defined in file ...\platformsdk\include\winnt.h as:
    >
    > typedef __nullterminated CONST WCHAR *LPCWSTR, *PCWSTR;
    >
    > and WCHAR is in turn defined as:
    >
    > #ifndef _MAC
    > typedef wchar_t WCHAR; // wc, 16-bit UNICODE character
    > #else
    > // some Macintosh compilers don't define wchar_t in a convenient
    > location, or define it as a char
    > typedef unsigned short WCHAR; // wc, 16-bit UNICODE character
    > #endif
    >
    > I have (obviously) not defined _MAC (I even verified that no rogue
    > include did so by testing "#ifdef _MAC\n#error _MAC defined!\n#endif),
    > so I expect the .lib file to export the function
    >
    > long __thiscall MyClass::MyFunction(wchar_t const *)
    >
    > Instead the output from dumpbin shows that my lib file exports the
    > function,
    >
    > long __thiscall MyClass::MyFunction(unsigned short const *)
    >
    > and my test dll client program builds with a LNK2019 unresolved
    > external symbol.
    > What's the deal?


    This question should be asked on a Microsoft-specific newsgroup. See
    this FAQ for what is on-topic here and for a list of other places you
    could try:

    http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.9

    Cheers! --M
     
    mlimber, Jul 31, 2006
    #2
    1. Advertising

  3. acc13

    acc13 Guest

    Thanks, I appreciate the heads up.

    New to newsgroups...
     
    acc13, Jul 31, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy
    Replies:
    1
    Views:
    403
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Jul 11, 2005
  2. Replies:
    1
    Views:
    1,221
    Oliver Wong
    Dec 15, 2006
  3. cppaddict
    Replies:
    5
    Views:
    1,980
    cppaddict
    Feb 26, 2007
  4. Allen
    Replies:
    2
    Views:
    406
  5. Henry Law
    Replies:
    4
    Views:
    183
    Henry Law
    Jul 20, 2006
Loading...

Share This Page