I have a C++ (and associated header) source file containing routines that I would like to use in VB.NET app. Possible? How?
Posted on 2006-07-06
What I've tried:
1)Compile as DLL with __declspec( dllexport ) on desired routines. Name mangling occurs. Unuseable.
2)Compile as DLL with extern "C" __declspec( dllexport ) on desired routines to respond to "name mangling". Errors during build. Unuseable.
3)Compile as DLL and try to add as reference in VB.Net project. Error results. Unuseable.
I am NOT looking for calls into unmanaged code routines from managed code. Surely calling .NET C++ routines from a .NET VB app must be more straightforward and doesn't need "wrapper" layers. I was under the impression that .NET managed code from any of the .NET languages was fairly interchangeable with regards to function calling,etc. (Or is this yet another Microsoft "true but with caveats" adventure?)
What is the best way to accomplish this without doing a port of the C++ code? If I have to do a port then I might as well just do the whole thing in C++ which is what I wanted to avoid in the first place.
BTW-I am using Visual Studio 2005