gcc vs g++ and linking with as
Stephen Williams
steve@icarus.icarus.com
Thu Jun 25 23:03:00 GMT 1998
choward@intellistor.com said:
> Compiling with as,gcc and linking with ld works fine. Compiling with
> as,g++ and linking with ld does not work,
> undefined symbols for those things written in assembler.
Even in C you can have troubles. What I do is use the "asm" attribute
to declare external variables, i.e.:
extern unsigned char __index_space asm("__index_space__");
which causes __index_space__ to be the actual symbol name at link time.
A function would work like this:
int foo(int i) asm("test_symbol");
int foo(int i)
{
return i+1;
}
This works with (GNU) C and C++. It is a good thing to do even with C
because sometimes you get the leasing _, sometimes you don't. etc.
--
Steve Williams "The woods are lovely, dark and deep.
steve@icarus.com But I have promises to keep,
steve@picturel.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."
More information about the C++-embedded
mailing list