Calling assembly code in Xcode

Discussion in 'Mac Programming' started by manish.kesarkar, May 3, 2009.

  1. manish.kesarkar macrumors newbie

    May 3, 2009
    Hi I have written a function nabs in assembly file mymath.s as follows
    .align 2
    .globl _nABS
    .private_extern _nABS
    stmfd sp!, {r3-r7,lr}
    ...... ......
    ldmfd sp!, {r3-r7,pc}
    I am calling this function from c function func1 in file myfunc.c
    I have declared nABS in myfunc.h as
    int nABS(int a);
    and included myfunc.h in myfunc.c
    Both myfunc.c and mymath.s are compiled sussessfuly and generate mymath.o and myfunc.o, but I get a linking error

    Undefined symbols:
    "_nABS", referenced from:
    _func1 in myfunc.o
    can anyone tell me why am I getting link error?
  2. newb16 macrumors regular

    Feb 27, 2008
    I don't know the exact answer, but -
    - does "nm" command output tells something useful?
    - If you compile with -S flag some simple C source containing function, and then try to assembly and link it, what happens?

Share This Page