XCode - creating and using a dynamic library (dylib)

Discussion in 'Mac Programming' started by webhunter, Feb 23, 2011.

  1. webhunter macrumors newbie

    Joined:
    Oct 30, 2010
    #1
    I want to create a simple dynamic library with four or five methods that are implemented in a mix of c++ and objective-c . I also want to implement an application that uses this library. Both things should be created with XCode in one project (with different targets).

    I've been working on this problem a long long time now, but I can't get it right. What steps need to be performed to create a dynamic library - for example with one function that prints "hello world" - and a console application that uses the .dlib in XCode?

    Thanks a lot!!
     
  2. kainjow, Feb 23, 2011
    Last edited: Feb 23, 2011

    kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    If you're only targeting Mac OS X, why not use a framework? Lots of documentation for that. Plus they're nice if you have resources or headers you want to bundle with the code.
     
  3. webhunter thread starter macrumors newbie

    Joined:
    Oct 30, 2010
    #3
    Thank you for your fast reply!
    Hm...later on I need to link this library to different applications, that run on different operating systems (from Mac OS X 10.4 upwards with different architectures). If this can be done with a framework as well, it would be an opportunity?!
     
  4. Sydde macrumors 68020

    Sydde

    Joined:
    Aug 17, 2009
    #4
    When you say "different operating systems", do you mean different versions of the same operating system (Mac OS X)? Because every version of OS X has supported frameworks. If you want to use it for Linux, Windows, WebOS, whatever, you would have to compile separate files (.dll, .so, etc) for each one.
     
  5. webhunter thread starter macrumors newbie

    Joined:
    Oct 30, 2010
    #5
    I meant Mac OS with different versions (version 10.4 upwards).
    Okay, so maybe a framework would fit my requirements. I'm going to try this out.
    Thank you so far
     

Share This Page