[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Help with #defines ....



Hi,

I want to add extern "C" to one of the functions which the users
of my shared library defines when he/she includes my header file.

For example :
In "myheader.h", I define
#define func extern "C" func

So, in usersfile.cpp

func(...) becomes extern "C" func(...)


But the problem is that I don't know (or care) about the return 
type of that function. It can be void or int (mostly)

So this will not work for

int func(...) as this will change into int extern "C" func(...)

How can I add extern "C"  to func(...) irrespective of whether it is
declared as void func(...) or int func(...) or just func(...) ?

(I don't have access to the userfile.cpp where my shared library
will be used.)

I hope I have explained the question clearly.

(using #defines can we replace two strings together, like
#define "int func" extern C int func 
or something like this ??  I know the above will not work :-( 

-Saravan