
Oh gurus, please help getting VC program into DLL
I would recommend that you create a New Dll project first then add your code
to it...
1. Select File, New Project from main menu
2. Select either Win32 DLL or
MFC AppWizard DLL
3. Once your new blank project is created, add your source code files to
it...
A DLL is more like a library, than a program. It is like you calling a
function and then having a value returned. If you need it to have a
separate process, you can use a CreateThread to simulate this.
4. Place all function calls which will be visible to VB into the *.Def file
created by VC for the Dll project.
5. Once this is compiled, determine the Declare statements needed to call
the Dll from within VB. The important part is that all parameters match for
size. Make sure that VC int = VB Long is used... because many think that
you would use a VB Integer which is not the same size. Signed and Unsigned
can be mixed, however Byte size must match.
6. A VC void function would be a VB sub, and VC int function would equate
to a VB Function.
7. If possible avoid more than One Dimensional array passing, because VB
and VC use differing Row and Col. Also if you are passing Strings read up
on how to do this in MSDN, the VB String is passed ByVal.
Quote:
> I am hoping that some of you have taken a Visual C program and compiled
> it in such a way as to turn it into a DLL that can be called from Visual
> Basic.
> What are the steps to do this?
> Is it in the MSDN documentation anywhere?
> thanks-Peter Brooker