What code library should I create for distribution?

I need to create a C ++ library to distribute to our clients. The library should have access to a wide variety of languages ​​including VB6, C ++, VB.net, and C #.

I have been using ActiveX controls (ocx files) ever since. But I am wondering if there is a library library (dll etc.) that I can create. What do you recommend?

I am limited to C ++ as the library language, but you can mention other languages ​​for reference to other developers.

PS Sorry if the question has already been asked. I was having trouble finding a suitable title. Feel free to correct my english.

Edit: It seems that the best choice is either DLL or OCX (i.e. COM), but I still have some doubts about which I will choose. Which one is more suitable for modern languages ​​(like .NET)? Which one is easier to use from the end developer's point of view?

+1


source to share


4 answers


Almost every language has a way to load dynamic libraries and access exported C functions from them.



Nothing prevents you from using C ++ inside a dll, but for maximum portability, export only C functions. I have more on this in this article .

+3


source


If you're looking for support for both VB6 and .NET, you're pretty much stuck with demonstrating interfaces via COM, but at least you won't need to create more than one language-based wrapper / with which you are trying to interact.



+3


source


If there is a chance this will need to be ported to windowless platforms, then DLL / Shared is your best bet as the COM object is really not portable at all.

In addition, you can call DLLs from almost any platform, even if you need to write some kind of wrapper. It is quite easy to wrap a dll in a com object, but if you are creating your own com object it is much more difficult to add a C style API. Also, you might want to call it from java for example, and it is much easier to write a JNI wrapper to call your DLL than to make it work with COM in any cross-platform path.

Indeed, it depends on what platforms you really need to call it on, and how sure you are that you won't get something fancy in the future.

+1


source


To be callable from all of these languages, your only real option would be COM, without having to write wrappers where necessary (to beat the point)

0


source







All Articles