Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling function defined in DLL lib

Status
Not open for further replies.

pukiamak

Technical User
Jul 14, 2006
44
US
Hello guys,

How can I call the function defined in Dll in Visual Studio?
I have tried using this macro

#define DllImport __delspec(dllimport)
DllImport FunctioName

but visual studio say it's unresolved external symbol. I have tried to go to the project's setting and include the additional libary but no luck. Any suggestion?

Thanks
 
I haven't used DLL's much in my projects, but I think you need to use LoadLibrary() and FreeLibrary().
 
hello xwb i have tried using __declspec but still Visual Studio does not see it..it is giving me error saying unresolved external symbol..any idea?
 
Creating the DLL
When the DLL is created, the routines should be prefixed with __declspec(dllexport). This will create 2 files: a .lib and a .dll.

Creating the program that uses the DLL
The routines should be prefixed with __declspec(dllimport)

Linking the program
Add the .lib created by the dll to the link line

Running the program
Make sure the .dll is either in the same directory as the .exe or somewhere in the PATH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top