Mail Archives: djgpp/1999/02/24/20:50:08.2
Carlos Giani_AEN2003 (M2003) wrote:
>
> Hello everybody. I got the DJGPPASM documentation by Matthew
> Mastracci, and I tried the C++ examples. NASM worked fine. But when I
> try to link my NASM object file with a C program, there appear some
> errors! Does NASM only work with C++ or what??
The problem is most likely with name mangling. In order to encode type
and other info with a symbol name, G++ changes it to something weird for
the assembly. However, for C, it leaves it as is, only prepending an
underscore.
So, a C symbol named `foo' would correspond to an ASM symbol named
`_foo', but a C++ symbol named `foo' might correspond to
`_foo__bat342u5ryhy345__' or something equally illegible, depending on
its type.
The best solution is to name all asm-exported symbols in C style, and
declare them with `extern "C"' when using C++.
It would help if you could post an example.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -