471,045 Members | 1,319 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,045 software developers and data experts.

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

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.

Jul 11 '06 #1
2 1038
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." <cv*******@avantel.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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.

Jul 11 '06 #2
"Carlos Villaseñor M." <cv*******@avantel.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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/de...lRegasmexe.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
Jul 11 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by pix | last post: by
14 posts views Thread by BOOGIEMAN | last post: by
1 post views Thread by Danny Toquothty | last post: by
2 posts views Thread by frossberg | last post: by
7 posts views Thread by André | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.