2

I have an Objective-C source file that I would like to compile as a dylib. I can't figure out how to do this anywhere. I don't care how to do it if it's Xcode or gcc, I just want it to compile.

Thanks!

Nate
  • 31,017
  • 13
  • 83
  • 207
SpyMachine
  • 470
  • 1
  • 7
  • 17
  • Can you give a little more detail on what you are trying to do? – Alex Wayne Jul 10 '12 at 00:08
  • I just want to know how I can take objective-c source and compile it as a dylib. (I'm assuming this is possible). I want to be able to hook a method in an iOS application with it. – SpyMachine Jul 10 '12 at 00:10
  • 1
    @user1419579 Unless a phone is jailbroken, iOS applications cannot link to dynamic libraries. All library code should be packaged into static libraries that are copied into the executable at build time. – Justin Spahr-Summers Jul 10 '12 at 00:23

3 Answers3

3

You can do this with Xcode. Xcode is just set up by default to prevent you from doing it. You can modify some XML files after installing (Xcode), and then it will let you configure your project as a dynamic library, instead of a normal iOS app (or static library).

See this link for instructions

and also this other answer for some more information on this issue, including the full instructions contained on the link above (in case the link someday dies).

Community
  • 1
  • 1
Nate
  • 31,017
  • 13
  • 83
  • 207
1

I would reccomend downloading IOSOpenDev. It sets everything up for jailbroken development.

Fire30
  • 166
  • 7
1

As @Fire30 touched on, iOSOpenDev extends Xcode to allow dylib compiling for the iOS platform. In fact, iOSOpenDev provides an Xcode template for this exact type of project.

Download it at http://iOSOpenDev.com.

Reference its wiki at https://github.com/kokoabim/iOSOpenDev/wiki/_pages.

j0k
  • 22,600
  • 28
  • 79
  • 90
kokoabim
  • 326
  • 2
  • 9