Building and Using a DYLIB in Xcode
Asked Answered
H

2

4

I'm trying to build a .dylib in Xcode. Currently the .dylib builds, but when I drag the .dylib into another project and try to #import one of the headers (Seeker.h) in the .dylib, I get this error:

*: No such file or directory
Seeker.h: No such file or directory

The project is available as an Xcode project here.

I can confirm the header is indeed in a path alongside the .dylib once built, but as for what to do with it I have no idea. My only experience with .dylib files is frameworks built into Mac OS X, like libsqlite3.dylib, which works perfectly. All the tutorials I can find on .dylib files does not cover how to use them with Xcode in a sensible manner; all of them rely either on complex scripts or machine-dependent configuration which will not work for us.

So basically I need a start-to-finish step-by-step process that successfully builds the .dylib and successfully includes it in another Xcode project in a way that's not dependent on changing build settings for different users. In other words, a way that just works and that will work when we distribute both projects to members of our team.

Horning answered 17/10, 2010 at 20:58 Comment(0)
P
5

Dylibs don't carry headers: they're brainless executable files. Built-in libraries have their headers in known locations, like /usr/include, which makes them globally available. What you're looking for is probably a framework.

Frameworks are packages that contain a dynamic library and header files, so once you link with the framework you can import the headers it has. It can also carry other resources such as images and sounds.

I suggest you read the Framework Programming Guide for more informations.

Poikilothermic answered 17/10, 2010 at 21:2 Comment(6)
Well, now I've created the framework and everything's crazy... I built it in Xcode 4 but it won't work in either 3 or 4; I recreated it in 3 using a new project and it won't work in 3 but it'll work in 4... ugh. I've actually had problems with frameworks before that were never resolved. WHY are there no good framework tutorials that actually work? We'll probably never know... in any case, now I'm stuck with NO functioning framework OR dylib...Horning
I did create a quick demo of the issue available here - this one has some major issues that I can't figure out. If someone can just figure out how to get that working, it would be a big help...Horning
Well, now I have this issue: cl.ly/2sDe I've uploaded a copy of the test project here. Basically everything seems to be working (headers and all) but the Image Not Found error comes up. I've used a few frameworks (and had the header issues) but I never saw this one before...Horning
Okay, I've got the important one working (!) but I still want to know what's going on with that sample project with the Image Not Found error, especially since it should be working. Also, if you're interested in what this actually is, here's the project on SourceForge, though nothing's uploaded yet. Basically it's an object oriented SQLite wrapper written in C++.Horning
I know this is an old post... did you manage to use libVlc in Xcode? Do you have a sample project?Geezer
@Pier, I have never attempted to use libVlc in Xcode. If you are running into issues with #include directives, double-check that the include path contains the path to the libVlc headers.Poikilothermic
C
0

You are not able to create static library .dylib from Xcode because they are using OS, but you are able to create a dynamic framework with .dylib inside

[iOS static vs dynamic library]

[Create dynamic framework]

Court answered 26/9, 2022 at 19:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.