Using NASM and Borland C++ 5.01

Using NASM and Borland C++ 5.01

Post by Philip Kno » Fri, 13 Feb 2004 03:12:19


Has anyone gotten NASM to work with Borland c++ 5.01?
I've gotten NASM to generate .obj files, but when I link
the linker complains about defined symbols. (These are
symbols that I define in my assembler code)
Is there any documentation about how to use BC 5.01
with an assmbler?

Thanks,
Philip Knodle
 
 
 

Using NASM and Borland C++ 5.01

Post by Ed Mulroy » Fri, 13 Feb 2004 04:01:55

Each symbol has a public name, the name that will be used by the linker. C
public names are the same as in the source code except that a leading
underscore has been added. C++ public names are formed differently. So if
you have this function prototype:

int MyFunc(int i);

The C public name would be _MyFunc but the C++ one might look something like
@MuFunc$qi

However if the function prototype in C++ code were this:

extern "C"
int MyFunc(int i);

Then the public name would be formed as if it were C langugage and might
match up with the public symbol from your assembly source file.

. Ed

 
 
 

Using NASM and Borland C++ 5.01

Post by Koms Bom » Fri, 13 Feb 2004 10:24:29

> Has anyone gotten NASM to work with Borland c++ 5.01?

1, If you want to call the assembly function from C, you should declare
the function name with a '_' prefix. When calling it from C, don't include
the '_'.
For example, you can declare a function in assembly like _MyFunc,
then call it from C, MyFunc(...).

2, If you really want to get an assembler work with BC++, TASM or LZASM
is a better choice.


*****Pardon my poor English*****
---------------------
My TASM homepage, resource for assembly. Tools, articles, links.
http://www.yqcomputer.com/