Xref: utzoo comp.lang.c++:9281 comp.sys.ibm.pc.misc:1223 alt.msdos.programmer:2094 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!uc!cs.umn.edu!ux.acs!hopper From: hopper@ux.acs.umn.edu (hopper) Newsgroups: comp.lang.c++,comp.sys.ibm.pc.misc,alt.msdos.programmer Subject: Re: On Linking TC++ to Assembly Language Message-ID: <2150@ux.acs.umn.edu> Date: 28 Aug 90 21:28:01 GMT References: <1990Aug20.143139.7100@ux1.cso.uiuc.edu> <90239.223422POPOVICH@ucf1vm.cc.ucf.edu> Reply-To: hopper@ux.acs.umn.edu (Eric Hopper) Followup-To: comp.lang.c++ Organization: Omnifarious Software Lines: 45 In article <90239.223422POPOVICH@ucf1vm.cc.ucf.edu> POPOVICH@ucf1vm.cc.ucf.edu (Peter Edward Popovich) writes: > >Since you have TC++, I'll direct you to look at the header files. Note how >they all have stuff (approxamately) like: > >#ifdef cplusplus >struct c { >#endif >char *srtcpy(char *,char *); >#ifdef cplusplus >} >#endif > Thirty-five and 1/2 people have probably already said this, but it really goes like this: #ifdef _cpluplus extern "C" { #endif char *strcpy(char *, const char *); #ifdef _cplusplus } #endif The main difference is the 'extern "C" {' instead of 'struct c {'. The extern "C" construct is a standard part of the C++ 2.0 AT&T spec. It says that all prototypes in it's scope are linked as C functions, not C++ functions. You probably want to do this for any assembly routine you write because different compilers use different name mangling schemes that are generally hard to figure out for naming assembly functions. Have fun, UUCP: rutgers!umn-cs!ux.acs.umn.edu!hopper (Eric Hopper) __ /) /**********************/ / ') // * I went insane to * / / ______ ____ o // __. __ o ____. . _ * preserve my sanity * (__/ / / / <_/ / <_<__//__(_/|_/ (_<_(_) (_/_/_)_ * for later. * Internet: /> * -- Ford Prefect * hopper@ux.acs.umn.edu /**********************/ -- -- Nils_McCarthy mtymp01@ux.acs.umn.edu rutgers!umn-cs!ux.acs.umn.edu!mtymp01 "The wonders of modern technology..." :-) :-) :-)