[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: C++ variant of OpenLDAP 2.0 alpha3



> Hmm....I am almost certain that you cannot call a C++ routine from C (program
> compiled with C compiler). In my case I need to call functions in a DCOM
> server which means that I need to import the wrapper interface of the DCOM
> using:

Are you wrapping the C++ code with extern "C"? The only complication with
calling C++ from C is incompatible name mangling of functions when they
are compiled and linked.

So you have your interface classes generated from the type libraries. Make
some wrapper routines to instantiate the interface objects you need, call
their methods, etc.

Then wrap those routines with extern "C"...I forget the internal compiler
define for C++, but it should look something like this:


#ifdef __cplusplus
extern "C" {
#endif


/* Your C++ functions to be called from C */


#ifdef __cplusplus
}  /* end of extern "C" */
#endif


Should do the trick.

tm