2

What's the best practice to include existing C Libraries into an iPhone Project? I searched the Internet and actually found some pieces but nothing that explains the exact way to do it.

I'm trying to include the following Citrix XenServer SDK Library.

Any help is appreciated. Thanks!

2 Answers 2

1

You could try to build a static library and link against that.
I didn't try that myself yet, but as far as I could see, libxenserver has libxml2 as its only dependency.
libxml2 is available on the iPhone so you might have a chance.
To get started, create a Cocoa touch static library project and drag the C files into the project.
Now you have to figure out where to place the include files.
This might get a bit tricky and you will start with a lot of compile errors, but to me it seems possible to get it compiled.

Sign up to request clarification or add additional context in comments.

2 Comments

yep, libxml2 should be included in MacOS X.
works! thanks. Really hard to choose which to accept, but you checked the dependencies! :) build successful
1

The way I did it was to just create an iPhone static library project in Xcode and drop all the library's files in there. Then check if it builds and if the build settings are appropriate for the library you wish to compile. To add the newly-created library to your binary, you should follow the steps explained in the bottom part of the Three20 readme.

Note that you can only add static libraries to iPhone projects if you wish to get them into the App Store. Xcode also doesn't provide means to create dynamic iPhone libraries.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.