PDA

Click to See Complete Forum and Search --> : Making My Own DLLs Using C++


iataman
Oct 29th, 2000, 06:51 PM
Hello World,

Is it possible for anyone to make his own function library
using Turbo C++ and make it available for VB projects?

In fact, i have a serial port communication program which
i wrote in Turbo C++. Thank God it is working, and i want
to use some of its funcs in VB. How can I, if possible?

Thank in advance.

parksie
Oct 30th, 2000, 02:47 PM
To make a DLL, there are linker options for it. However, you need to tell it what to export. Firstly, the function must use the stdcall calling convention (check your manual - try __stdcall or stdcall), and there must be a .def file. For example:

testdll.cpp

long __stdcall exportfunc(long x) {
return x * x;
}


testdll.def

LIBRARY "TESTDLL.DLL"

EXPORTS
exportfunc


Then, to use in VB, just make a declare for it.