How to compile C dylib for iphone?

Discussion in 'iOS Programming' started by pityme, Aug 8, 2008.

  1. pityme macrumors newbie

    Joined:
    Aug 4, 2008
    #1
    Does anyone know how to compile a dylib on Mac leopard and use it in iphone apps?

    Or any hint on how to compile a C program in Mac OSX, and execute it in iphone 2.0 terminal?
     
  2. DipDog3 macrumors 65816

    DipDog3

    Joined:
    Sep 20, 2002
    #2
    iPhone 2.0 Terminal...what is this?
     
  3. pityme thread starter macrumors newbie

    Joined:
    Aug 4, 2008
    #3
    Here is the situation:
    I want to write some C program and run it on iPhone.

    iPhone has different CPU than the Mac so I have to use a different compiler to compile the codes. I am not sure but I think xcode uses arm-apple-darwin9-gcc instead of a normal gcc for Mac to compile code so the resulting executable could be run on iPhone.

    So anyone could tell me if I want to compile a C program by going through :
    ./configure > make procedure how could I do it?
     
  4. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #4
    You do realise that Apple forbids the use of third party libraries on the iPhone don't you? If you do use a solution I doubt you'll be able to release the app on the App Store.
     
  5. pityme thread starter macrumors newbie

    Joined:
    Aug 4, 2008
    #5
    Thanks for the reply.I have heard about that.
    That's why I have to make libaray myself.
     
  6. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #6
    Well that is my point. No third party libraries at all, even ones written by yourself. I would love to be proved wrong on this as I have a library I would find useful in an iPhone app, but I'm 99% sure that no external libraries are allowed.
     
  7. pityme thread starter macrumors newbie

    Joined:
    Aug 4, 2008
    #7
    So for the official apple store apps, instead of using dylib and frameworks, I have to compile everything in xcode? oh~~~it's a lot of work then.....

    But for the hacked iphone and unofficial apps, ppl still can use libraries right?:D

    Do you know how to cross compile iphone program on mac?
    here is the command i use to configure the make.
    ./configure --cross-prefix=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ --enable-cross-compile --cc=arm-apple-darwin9-gcc-4.0.1 --arch=armv

    It always shows me "C compiler test failed."
    I think it is because the code is not compatiable to the compiler right?Anyone could give some hints?
     

Share This Page