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

A

acc13

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...
 
M

mlimber

acc13 said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top