Advertisement

C++ DLLs and VB... HELP!!

Started by November 06, 2000 09:16 PM
4 comments, last by TrIaD 24 years, 2 months ago
Does anyone know how to compile a DLL in C++ so it can be added as a "reference" in VB? (not by using "Declare ...", but the way you can add a VB DLL created with the class instancing set "Global Multiuse")? Do you have to implement the DLL as a class exporter? The help files seem to be vaguely implying I need a ".tlb" (typelib) file, but I have no clue how to make this. --Tr][aD--
--Tr][aD--
If you want to create a C++ binary that can be used in VB like that you need to create a ActiveX/COM binary, it sounds like what you want is in-process component, so look up the docs in MSVC for ActiveX DLLs. If you use the wizards that MSVC supplies you should generate the type libraries automatically for you.
Advertisement
Let me rephrase that... is there any way to do it in "C"?

--Tr][aD--
--Tr][aD--
Yes, you can create an COM binary in C, and from the binary can extract the type library. But it''s orders of magnitude more painful than just letting the class wizard do it for you. (and even then you should probably start with the idl file and work from there) Working with C++ is much, much easier for this kind of thing, especially with ATL.

But if you do it in C, you need to implement all the basic interfaces, export your own interfaces and create the required vtables. If you really want more details about this particular brand of masochism, look up "Introduction to COM" in MSDN.
err...okay, thanks... I think...
I''m going to start by preferring that way, since I don''t want to use a class, and besides, I never bothered to learn them :^)... I dislike C++, actually... I''m discovering new things every day that make me hate it more... but I like C. :^)

--Tr][aD--
--Tr][aD--
I suppose it would be a bad time to mention the fact that you still have to create a COM class (it just happens that you can implement a COM class in C). IUknown, the whole nine yards.

This topic is closed to new replies.

Advertisement