unicode and linking problems

B

bobnotbob

I have created an application and am trying to call functions from a
previously existing dll. I can call some functions fine, but I get a
link error an when I try to call any function that takes either an
LPCTSTR or wchar_tas a parameter.

I am using C++ and Visual Studio .NET.

Here's two functions that cause me problems:
void CADAPICALL JuncFunc9(LPCTSTR aaa);
void CADAPICALL JuncFunc10( wchar_t * aaa);
(CADAPICALL is defined as __declspec(dllexport) or
__declspec(dllimport))

Here's the errors I get:
InspectionPlanner error LNK2019: unresolved external symbol
"__declspec(dllimport) void __cdecl JuncFunc10(wchar_t *)"
(__imp_?JuncFunc10@@YAXPA_W@Z)
InspectionPlanner error LNK2019: unresolved external symbol
"__declspec(dllimport) void __cdecl JuncFunc9(char const *)"
(__imp_?JuncFunc9@@YAXPBD@Z)


I thought that maybe the problem is that the dll uses unicode, so I
converted my application to a unicode app by defining _UNICODE and
UNICODE in the project and adding the entry point wWinMainCRTStartup,
but I still got almost the exact same errors, except that LPCTSTR was
converted to "const wchar_t *" instead of "const char *"

Does anybody have any ideas what else might be causing these linking
problems?
 
J

Jochen Kalmbach [MVP]

Hi bobnotbob!
but I still got almost the exact same errors, except that LPCTSTR was
converted to "const wchar_t *" instead of "const char *"

Have you compiled with the same switches? Especially /Zc:wchar_t ?

It seems the the DLL is compiled with "/Zc:wchar_t" and you app is not.

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
B

bobnotbob

Thank you. My app was compiled with that switch, but the dll was not.
I changed my app to match the dll, and it's all gravy. :)
 

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

Top