> Do you have any advice to make the code work both under Apple and GNU gcc?The leading underscore for external symbols is standard, if that's what you're referring to. http://en.m.wikipedia.org/wiki/Underscore#Origins_in_identifiers -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130219/8adf3c3a/attachment.html>
But it's unreasonable that if I declare a function 'foo()', then I have to implement '_foo()' in assembly, doesn't it? Best regards, ashi On Wed, Feb 20, 2013 at 10:01 AM, Tyler Hardin <tghardin1 at catamount.wcu.edu>wrote:> > Do you have any advice to make the code work both under Apple and GNU > gcc? > > The leading underscore for external symbols is standard, if that's what > you're referring to. > http://en.m.wikipedia.org/wiki/Underscore#Origins_in_identifiers >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130220/dcd04760/attachment.html>
So it turns out that I was wrong. It, in fact, is not standard. But regardless, you can use asm to specify the exact name. Eg. extern int func() asm("func"); You can read more here: http://stackoverflow.com/questions/1034852/adding-leading-underscores-to-assembly-symbols-with-gcc-on-win32 Despite the title of the thread, the solution is compiler and system independent. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130220/e0eae81e/attachment.html>