I just created a DLL for my boss in MSVC++2010. I selected \"New Win32 DLL\" with option \"Export symbols\", so, everything is completely standard. There are some predefined
If it's not a COM library, you need to export only C function with __stdcall
. You might need to create .def file for them (http://msdn.microsoft.com/en-us/library/d91k01sh(VS.80).aspx). Also use dependency walker, e.g. depends.exe to see what functions were exported and with which names.
Yeah, VB6 doesn't work like that. You need to declare the DLL functions in your VB code somewhat like this:
Private Declare Function WinHelp Lib "user32" Alias "WinHelpA" _
(ByVal hwnd As Long, ByVal lpHelpFile As String, _
ByVal wCommand As Long, ByVal dwData As Long) As Long
You would replace "user32" with "MyCPlusPlusDLL.dll" and use the actual method names and signatures etc. from your DLL. Then put the DLL in your /System folder and you should be good to go.
Note: this is assuming that the methods inside your C++ DLL are declared with "__declspec".
For a regular DLL, you can't use VB references, but rather need to use the Declare statement. Another option would to be create the DLL as an ActiveX component instead.
The easiest way to make a DLL in C++ and consume it from VB6 is to use COM.
I see you already accepted an answer, but this may be of use to you or others. The Universal DLL Function caller, by Paul Caton uses assembly language voodoo to enable VB6 to call different types of DLL functions not normally callable from VB6.