Mail Archives: djgpp/1999/01/12/04:02:22
On Mon, 11 Jan 1999, Laurence Withers wrote:
> // obj.cc //////////////////////////////////////////////////////////////
>
> // C++ function
> int cplusplus_tester_function(int a, int b)
> {
> return (a + b);
> }
>
> //
> // C wrapper
> //
> extern "C" {
> int c_tester_function(int a, int b)
> {
> return cplusplus_tester_function(a, b);
> }
> }
>
> // end of obj.cc ///////////////////////////////////////////////////////
It should be emphasized that this technique will only work if both the
C wrapper and the C++ function it calls are defined in the same source
module. Otherwise, you are back to square one.
- Raw text -