This topic is now archived and is closed to further replies.

how to link a library at load time??

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have to link a library to my project at load time. where in Project Properties should i specify the path for the library or the library name ?? right now i am specifying it under Configuration Properties->Linker->General->Additional Library Directories but this is not linking the library ???

Share this post

Link to post
Share on other sites
hmm my config is broken, i think i need to reinstall my ide, but you can always use this in one of your cpp files(AFAIK):

#pragma comment(lib, "opengl32.lib")


Share this post

Link to post
Share on other sites
There is more to the problem tough, so i have also posted t separately on the forum...but if u can wud be great help--

I am linking an unmanaged library at Load time in my project.

#pragma comment(lib,"xyz.lib")
This library exports a simple method which returns "42".
exported method code is:

return 42;

The code is Building properly.

BUT---- when i run the application (actually a web service) i get an error page.
"Configuration Error :

Parser Error Message: File or assembly name TestClassExport, or one of its dependencies, was not found.

same library if i test using an MFC exe application, is working fine.i.e. the method returns 42 to the MFC client.

so if u can help me out to understand what is happening..!!!!!

Share this post

Link to post
Share on other sites