Xref: news2.mv.net comp.os.msdos.djgpp:5941 From: Pål-Kristian Engstad Newsgroups: comp.os.msdos.djgpp Subject: Re: How to write ASM member functions? Date: Sat, 13 Jul 1996 03:44:10 +0200 Organization: Funcom Oslo AS Lines: 42 Message-ID: <31E6FF6A.30D8@funcom.com> References: Reply-To: engstad AT funcom DOT com NNTP-Posting-Host: khazad.funcom.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Content-Transfer-Encoding: quoted-printable Tero Lauri Juhani Parvinen wrote: >=20 > Can I write a classes member functions in asm? I would like to define t= hem in > a .S file, not inline. The obvious problem is that I can't just define = the > function like _function (C-style). I looked at some .o files and found > something like _func__5MyClass_iiPc... I think the iiPc means that the > parameters are int, int, *char, but what about that weird 5? Well, you shouldn't. This is because the C++ name mangling might change in the future. Instead, you should make inline C++ wrapping functions: extern "C" { /* Place C and assembly functions here. */ int myAssemblyStub(int a, int b); }; class AsmClass { : : int myFunc(int a, int b =3D 0) { return myAssemlyStub(a, b); } }; > Is there a simpler way to do this or does someone know what the number > stands for? Well, if you really want to know, the numbers usually stand for the number of characters in a struct/class name. For instance: _play__4game_ii ---> game::play(int, int); _play__4game_RC8fix16_16 --> game::play(const fix16_16 &); Note that the program cxxfilt.exe converts mangled names back to C++ name= s. Also note that the macro __FUNCTION__ returns the mangled name, while __PRETTY_FUNCTION__ returns the C++ name. PKE. --=20 ---------------------------------------------------------------------- | P=E5l-Kristian Engstad | engstad AT funcom DOT com | Games programmer, PSX | | Funcom Oslo AS | Ph +47 22 42 01 02 | developer & Linux Fan | ----------------------------------------------------------------------