I'm now at the point of making my API (thinking while helping my sister with her house). I just thought up the killt / killp combo for C, where these could both be called kill in c++ (with a different argument, one of which would probably be signed to work along with name mangling). For the C++ people this is a lot more useful, but since C programs can also be compiled with a C++ compiler, the c++ compiler must both know kill(pid_t) and killp(pid_t). They are 100% the same, so if they could both end up in the object file pointing to the same address, all would be fine. I know I can craft an object file which works like that.
How do I craft it properly with C and C++? My guess would be:
Code: Select all
#ifdef __CPLUSPLUS
void std::kill(pid_t process)
extern C {
#endif
void killp(pid_t process) {
....
}
#ifdef __CPLUSPLUS
}
#endif
Code: Select all
#ifdef CPLUSPLUS
void __ZN3std4killEt(pid_t process)
#endif
void killp(pid_t process) {
...
}
Hope you can help, Candy