Generic Usenet Account wrote: > Rolf Magnus wrote: >> Hello Generic, your question is off-topic in all the newsgroups you >> posted, since it isn't about Standard C++, Standard C, and not about D >> either. >> > > I DISAGREE. The whole topic pertaining to the interworking between C > and C++ code is of great interest to an entire community of > programmers.
comp.lang.c and comp.lang.c++ are about the C resp. C++ language as defined by the ISO standards. Those don't define how the code is linked or how code compiled from different languages interacts, and so problems you might find when linking C and C++ code together are mostly (*) platform/compiler specific, which means that such questions are best dealt with in a platform/compiler specific programming newsgroup. (*) One thing that the C++ standard does mention (but not define) is "C" linkage. When writing a function in C++ that is supposed to be called from a C function, you should declare it as extern "C". However, since there is no specific linkage defined by the C standard, this will only work if the C compiler actually uses the same linkage. For gcc/g++ (and here we're compiler specific again), this is true. > IMHO it is not OT for comp.lang.c or comp.lang.c++. As > far as comp.sources.d goes, any posting that pertains to source code > falls within its realm. It seems to me that postings that ask for or offer source code (neither of which you were doing) are on-topic in comp.sources.d, but I haven't looked well enough to judge that. I was wrong to assume that it's about the programming language D, so now I dare only speak for comp.lang.c and comp.lang.c++. >> > code. Obviously, the library API is functional, >> >> What do you mean by that? It works? > > I though that my statement was pretty obvious. If the API needs to be > invoked by C as well as C++, the API cannot be defined in terms of > public methods on a class. It has to be defined in terms of > "free-standing" functions. Ah. I see. >> xpost&f'up2 gnu.g++.help > > I don't know what makes you feel that this topic is more relevant to > the gnu.g++.help newsgroup. My query was general, and not pertaining > to g++. However, the answers are mostly compiler specific, like mine that adviced you to link everything with g++. > I submit that the issue of interoperability between C and C++ code has > less to do with the compiler that is being used and more to do with the > difference in C and C++ linkage. The problem is just that C and C++ don't define a specific linkage. The compiler does that. > I am therefore "undoing" the f'up. I won't fight with you over f'ups. ;-) _______________________________________________ Help-gplusplus mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gplusplus
