Start with declaring your exported function as extern "C" so that the C++ name mangling doesn't occur. Next, all strings passed/accepted must be ANSI, not Unicode (IOW, VB can't call Unicode versions of functions)
Then inside VB, define the function prototype as:
[tt]
Private Declare Function MyFunction lib "MyDLL.DLL" (ByRef FirstParameter as Long, ByVal SecondParameter as Long) as boolean
[/tt]
where:
"Private" refers to the visibility of the prototype.
"MyFunction" is your exported function name.
"ByRef" and "ByVal" control whether the contents of a parameter can be modified
Note that strings in VB must always be passed ByVal, otherwise you get the address of the BSTR, and not a pointer-to-char.
You can also create subroutines (C functions that don't return a variable) besides functions. Because of the BSTR/PCHAR problem, VB has a tough time calling functions that return a string, so try and make string return values part of the parameter list.
Datatypes in VB are pretty close to C, except that they're always unsigned, and a "int" in C is a "Long" in VB. A "short" in C is a "Integer" in VB.
Chip H.