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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dlls - Please Help

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hi all. i have created a dll. i only have the dll, the lib file and a list of functions. now how can i use this dll in my projects. i have never added external dlls b4. please help :(
 
Hello ,

to use your dll , create a new project (a win32 console application for example) in vc++. In the project settings>link>Object/Library modules write the path and the name of your lib , for example

c:\mystuff\mystuff.lib

inside the code , include the .h file like:

#include "c:\mystuff\mystuff.h"

in the tools>options>directories , set the directories of the include files and the directories of the lib files. These will be the directories where vc++ will find for your .h and .lib files.

Now you can use the code that you made for your dll.

Thor da Silva

 
Try search help on smth like following example.
Moreover, you must make additional exercises on parameters passing between VB and VC++. In VC++ must be additional parameter for returning value from VB functions. Return values of VB functions are error codes, i'm not shure, something like that:

Function MyFunction(iPar As Integer) As Long;
int MyFunction(int iPar, long *plRetVal);


#include <windows.h>

typedef void (*fun_ptr_type)(int);

int main()
{
HINSTANCE dll_instance;
fun_ptr_type fun_ptr=NULL;

dll_instance=LoadLibrary(&quot;my_lib.dll&quot;);
if(dll_instance!=NULL) fun_ptr=(fun_ptr_type)GetProcAddress(dll_instance, &quot;MyFunction&quot;);

// ....

return(0);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top