This is the scenario.

I am a novice in using a dll in Visual C++.

I have a .dll shipped with a camera. I have to call the functions in the .dll for which I don't have any .lib file. Upon request they have given a header file. Referring to some articles I came to know that we can call .dlls implicitly or explicitly.

I tried calling a dll explicitly using LoadLibrary but found very tedious.

Then I tried to call implicitly by creating a .lib for the dll using LIB utility (lib /defSmile.Now when calling the function in the dll, implicitly using the .lib, I am being reported:

unresolved external symbol "int __cdecl SmdiGetDeviceCount(void)" ( SmdiGetDeviceCount@@YAHXZ)

Prior to generating a lib file I have written a .DEF file which looks like this:

LIBRARY "smdi.dll"
SmdiSetCertAuthority@@YAHPAXHPADH@Z @19
SmdiSetCertificate@@YAHPAXHPADH@Z @20
SmdiCancelCaptureIris @1
SmdiCaptureIris @2
SmdiConnect @3
SmdiDisconnect @4
SmdiDisplayText @5
SmdiGetCurrentDeviceState @6
SmdiGetDeviceCount @7
SmdiGetDeviceInfo @8
SmdiGetDeviceName @9

I have set some properties in Project Settings but not sure whether they are set correctly.

Help me rectify the mistake.

Re: Visual C++ General Help me link a dll with my program---please read the scenario

Ramkrishna Pawar

You need to load the DLL by yourself, get the addresses of those functions, and then call em.

LoadLibrary Function (Windows) is used to load the DLL, it returns you the handle to loaded DLL, then

GetProcAddress (Windows) can be used to locate the function inside this DLL, and then you can invoke the function using a function pointer.

Here is some sample code for you,

Using Run-Time Dynamic Linking (Windows)