macho and underscores on global function names

Mark Charney markcharney at gmail.com
Fri Mar 16 09:11:31 PDT 2007


On mac, yasm needs to name a function "_foo" so that it can be called  as
"foo()" from C.
               global _foo
_foo:
         ...

On linux  using gcc or using cl/ml on windows , the assembler needs to call
a function "foo" so that it can be called "foo()" from C.

            global foo
foo:

(A fly in the ointment occurs when using  gcc under cygwin on windows, the
assembler needs to call the function _foo with an underscore.)

Is this something yasm can handle -- possibly with an option? -- to allow
more portable assembly langauge?
That is, add the underscore prefix global symbols for macho output format
files?

The workarounds I have available are:
          (1) use ifdef's in the c program that calls it, (kinda ugly)
          (2) double-label everything, with and without underscores, or
          (3) preprocess my .s file before assemlbing it to add the
underscores as required.

Or am I missing the big picture? Sorry to beat a dead horse if that is in
fact what this is.

Thanks,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cvs.tortall.net/pipermail/yasm-devel/attachments/20070316/d33e202e/attachment.html 


More information about the yasm-devel mailing list