We help IT Professionals succeed at work.

Implementing a C++ Class for use in Visual Basic

Steve Frase
Steve Frase asked
on
227 Views
Last Modified: 2013-11-25
I have written a difficult class in C++ that I need to access from Visual Basic.  I have written Dlls in C++ in the past that exported functions, but, never a class.
I have looked at the __stdcall and the .def file, but, I can see no way to export the class itself, only it's functionality.
In such a case, I would consider using COM, or possibly starting over and creating the same functionality without using a class, but, I really don't want to.  Can anyone tell me the best approach to taking my existing C++ class and making the class itself accessible to VB?
Comment
Watch Question

Commented:
@Steve_Frase:

>  Can anyone tell me the best approach to taking my existing C++ class and
> making the class itself accessible to VB?

I don't think that you can.  I think you'll need to make a COM wrapper around the class to make it usable in VB.  But if you do, then you can use it in any language.  :)

Hope That Helps,
Dex*
Steve FraseWindows Developer

Author

Commented:
How difficult is the COM wrapper, and any tips on getting started?
I have the book from MS Press "Inside COM" but it's overkill, I think!
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
jkr
CERTIFIED EXPERT
Top Expert 2012
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Commented:
No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: Dexstar {http:#10335405} & jkr {http:#10335503}

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.