Interfacing with C libraries in Objective-C

Discussion in 'Mac Programming' started by Monkaaay, Oct 9, 2007.

  1. Monkaaay macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #1
    I'm told Subversion has a C interface by using it's header files. I'm looking for some direction in how I'd set this environment up in xcode. I have a Cocoa application I'm going to use. How would I go about making my Cocoa application aware of the Subversion header files so that I can call them in my project?
     
  2. Eraserhead macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #2
    You can just call the C code directly, Objective C fully supports C code (after all it is a superset of C).
     
  3. Krevnik macrumors 68030

    Krevnik

    Joined:
    Sep 8, 2003
    #3
    XCode normally likes seeing things in frameworks, but you can also link against paths.

    In the compile/link settings for your project, you can add paths to the headers, and paths to the libs (you will need those as well). Be aware that doing it this way will make it so that the app will only /launch/ on machines with a compatible version of SVN installed, so it isn't ideal for distribution.

    It isn't too horribly difficult to create your own SVN.framework bundle with the libs and headers there, and then link against that and copy it into your app bundle for something you intend to distribute. In fact, someone might have already done it.
     
  4. Monkaaay thread starter macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #4
    Do they put out a release package with just the header and lib files? Or, do I need to compile it locally and use that?
     
  5. Krevnik macrumors 68030

    Krevnik

    Joined:
    Sep 8, 2003
    #5
    Not as far as I know, but you don't /need/ to compile it locally, either. A pkg install of SVN will place the libraries and headers into your system to compile against.

    Producing a framework won't be easy as I first thought, as SVN has quite a few libraries.
     
  6. garethlewis2 macrumors 6502

    Joined:
    Dec 6, 2006
    #6
    If you wait a while, say until the 26th October you will get Subversion as a Framework automatically. It is becoming the standard repository for source code system wide. So you could just add that into your project and call the code directly. Of course the downside is a Leopard only application.
     
  7. Monkaaay thread starter macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #7
    Any chance you know where these are in Tiger? I've been searching around and have only found the binaries.
     
  8. Monkaaay thread starter macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #8
    Sweeet. That would totally work for me. :)
     

Share This Page