
Call C++ Class member function in a DLL ??
Quote:
>Does anyone out there have any experience in calling C++ class member
>functions in a DLL from VB ??
>If you do, then I am very interested in hearing from you. I need to build
>a DLL using C++ classes with a Visual Basics front end. At this point I
>don't know if this is possible. How would you reference a class member
>function from VB?
As far as I know, this is semi-impossible - the C++ compiler mangles
the names of all functions - including class member functions. For
regular (non-member) functions, you can get around this by using
declaring them as extern "C" :
extern "C" {
myFunc(...);
Quote:
}
This doesn't work for member functions.
I've dodged the problem by declaring some intermediate functions that
don't do anything but call the member functions:
extern "C" {
CallTheMember(...);
Quote:
}
CallTheMember(...)
{
return Object.MemberFunction(...);
Quote:
}
Of course, you have to watch your return types!
hth
gordo