# Problems with dll

This topic is 1724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have a dll and I'm trying to use it in an app.I added __declspec(dllexport) to the class I'm trying to use,but I still get unresolved symbol for one of it's functions.

Suggestions?

##### Share on other sites

Have you actually implemented the function (i.e. not just declared it?)

EDIT: It's not a template function is it?

##### Share on other sites

It's not a template function,and yes it's implemented.

NOTE: There are other functions,like the constructor in that class which i can call without problems,the only problem is caused by one function....

##### Share on other sites

Post the declaration and the error then...

##### Share on other sites
class __declspec(dllexport) Terrain{

public:

bool            LoadHeightMap ( LPCTSTR FileName, ULONG Width, ULONG Height );

}


##### Share on other sites

And the error. Also show how you call it (and include the declaration of Terrain object you call it with).

Could be a typo, perhaps?

EDIT: And I see you use an LPCTSTR, are both builds using the same character types (i.e. ANSI vs. UNICODE build)? <<< My guess of what is wrong. My typo guess is something along the lines of LoadHieghtMap instead of LoadHeightMap.

##### Share on other sites

damn it...i was using ANSI in one,UNICODE in the other...that was the problem...

##### Share on other sites

I knew it!

You can define both versions as well and use a macro to call the correct implementation (see how MessageBox is mapped to either MessageBoxA or MessageBoxW in the windows headers).

EDIT: Since it is C++ you don't even need a macro, you can just overload the function for both types of parameters. MessageBoxA and MessageBoxW are C functions so a macro is required.

1. 1
Rutin
23
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 29
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631739
• Total Posts
3001958
×