How to make a DLL in C++ an duse it in Visual Basic 6?

  • Thread starter Thread starter Carlos Villaseñor M.
  • Start date Start date
C

Carlos Villaseñor M.

Hi Everybody!

I need to develop some functions in C++.NET DLL and share it to Visual
Basic 6.0, which is the best path to create a C++ DLL an then use that
function later...?

I appreciate some help.

Thank you
Carlos Villaseñor M.
 
Option 1: export a function normally and use the declare statement in VB6
Option 2: Write a COM object (e. g. in ATL) and add a reference to the TLB
in your VB6 project

For the first one, the C++ lib is easier to implement and the VB6 client is
more difficult to implement. If you go for the other option it is just the
opposite.

Marcus
 
Carlos Villaseñor M. said:
I need to develop some functions in C++.NET DLL and share it to Visual
Basic 6.0, which is the best path to create a C++ DLL an then use that
function later...?

You don't say whether this DLL contains native or managed code. If the code
is managed (i.e. it targets the .Net platform) then the DLLs you make with
VS are assemblies whcih contain classes. Those classes can appear to be COM
objects to the likes of VB if you "register" the assembly.

This link descrribes the registration tool, regasm:

http://msdn.microsoft.com/library/d...ml/cpgrfAssemblyRegistrationToolRegasmexe.asp

If the code in the DLL is native, I'd suggest you build a COM object because
COM was invented for VB (GD&R). To that end you could use ATL to take some
of the sting out of COM development. This page may help to get you started:

http://www.codeproject.com/atl/com_atl.asp

Regards,
Will
 
Back
Top