Wrapping C++ in C.
Thu Feb 3 16:53:00 GMT 2000
On Thu, 3 Feb 2000, Joe Buck wrote:
> > 1) According to the C++ Faq lite when mixing C and C++ code there are
> > several caveats:
> > * Your C++ compiler should direct the linking process (e.g., so it can
> > get its special libraries)
> You can use gcc rather than g++ to link, provided that you add
> -lstdc++ -lm
> to the end of your link line.
What is the C++ code is in a shared library?
> > How much of this applies on a Posix system?
> If you want to let people use other C++ compilers than g++, all of it.
Um, maybe I am just being stupid but don't most unixes have a standard C
calling convention? If not how is it that gcc can use standard system
libraries compiled by a different C compiler?
Also how do static variables in those libraries get initialized?
> > 2) Is it possible to get a function pointer out of a C++ member
> > function?
> These are general C++ language questions, not for this list. A pointer
> to member function and a pointer to function are very different beasts.
Yes I know that. That was NOT my question. I am looking for a gcc
specific answer. As I understand it member functions are almost like
normal functions except that there is a hidden this parameter and for
virtual member functions there is also a lookup on the virtual table.
More information about the Gcc