dylib

How do I create a dynamic library (dylib) with Xcode?

I'm building few command-line utilities in Xcode (plain C, no Cocoa). I want all of them to use my customized version of libpng, and I want to save space by sharing one copy of the library among all executables (I don't mind re-distributing .dylib with them). Do I need to do some magic to get libpng export symbols? Does "Link Binary Wi...

How to insert a LC_LOAD_DYLIB command into a Mach-O binary (OSX)

I'm looking to patch a piece of abandonware with some code. The software is carbon based, so I can not use an InputManager (at least, I do not think I can). My idea was to add a dylib reference to the mach-o header, and launch a new thread when the initialization routine is called. I have mucked around with the mach-o header using a he...

How can I link a dynamic library in x-code?

I am currently developing a program in Qt and it uses the library libqextserialport.1.dylib. I build it and run in x-code and it spits back: dyld: Library not loaded: libqextserialport.1.dylib Referenced from: /Users/samuelreh/Desktop/QtOpenCV/build/Debug/QtOpenCV.app/Contents/MacOS/QtOpenCV Reason: image not found The libra...

Setting a charset symbol in dylib

I use an old Powerbook G4. While trying to update the macports (sudo port -d selfupdate) following error exist. dyld: lazy symbol binding failed: Symbol not found: _locale_charset Referenced from: /usr/bin/rsync Expected in: /usr/lib/libiconv.2.dylib dyld: Symbol not found: _locale_charset Referenced from: /usr/bin/rsync Expect...

iphone warning libsqlite3.dylib is not of required architecture?

I'm writing an iPhone app which seems to run fine on the simulator, however when I try and run it on the device I get a libsqlite3.dylib, file is not of the required architecture error. I'm using os 3.0 on a 3GS. Any ideas on what could be causing this? Thanks! ...

creating a .dll on a mac: .dylib or framework?

Hi all, I need to create a Mac version of our libraries for one of our customers. I am not so familiar with dynamic libraries on Mac, but from what I understand, I have 2 options: .dylib or frameworks. What would be the best option? Why? Few related questions: If I understand well, .dylib have to be installed in one of the stnadard U...

linking and using a C++ library with an Objective-C application

I'm writing a graphical application using Objective-C for the front end and C++ for the graphics processing and network communication. I read around on Apple's site looking for a way to link either a .dylib or .so with my C++ code in it to my Xcode project, but nothing seemed to work. I was able to get the project to reference it and lin...

How to specify compatibility version for dylib in iPhone projects?

I recently added a static library (mobclix) to my iPhone project which required me to set the Base SDK to 3.0. This library is claimed to be compatible with 2.2 and so far it looks like it's true. I set the project's Deployment Target to 2.2. No problems there. Now, I am also using libxml2 in this same project. Apparently, the libxml2.2...

Removed MAMP from OS X, dyld still using MAMP libraries

When I try and use a populator or sphinx on a Ruby app I keep receiving dyld errors. I used to use MAMP on OS X Leopard but since I've upgraded to Snow Leopard and am now using standalone MySQL (10.5 64-bit). $ rake ts:index Would return dyld: Library not loaded: /Applications/MAMP/Library/lib/mysql/libmysqlclient.15.dylib Referenc...

Using a category in a dylib to extend a binary's class

Hello, I have an objc app that has the class Foobar and I want to make a dylib that will be loaded into that app on start and extends the class Foobar with a few methods. Unfortunately I cannot build the library, I get the following linker error: "_OBJC_CLASS_$_Foobar", referenced from: __objc_const@0 in Foobar+MyStuff.o ...

Create jnilib from x86_64 .a files on Mac OS X 10.6

I want to use a bunch of non-universal (thin?), x86_64, C libraries from a Java application. The problem is that I only have static versions of them (.a files) and the jvm needs them to be dynamic. I tried using libtool to combine the files into a single dynamic library but I just got error messages saying that many of the symbols (poss...

Creating a plain C shared library in Mac OS X that uses Objective-C libraries

Hi, I want to create a plain BSD library in Mac OS X which provides a plan C wrapper for Objective-C bases system APIs (like the CoreLocation API). Although I've written and gotten this to compile, it won't load from DLOpen in other programs. I used the "Cocoa library" project type, because when I used the normal "BSD Library" project t...

Copying dynamic library (.dylib) into a framework (.framework)

I have two XCode projects: a framework and a client application. My application depends on my framework and everything works fine with that — the framework is being recompiled everytime the app is, the projects build paths are set correctly, it's completely okay. Now the framework started using 3rd party dylib file, and it's linked aga...

dynamic libraries in XCode

I am trying to create an mac application in XCode that has some of its implementation in a dynamic library. I added a new target (dynamic library) to my XCode cocoa project and after a bit of fighting with frameworks and precompiled headers, have the dynlib compiling - and running successfully from the debugger. When run standalone how...

Linking to a dynamic library on a Mac with full path

I am linking a (Python extension) library that embeds the Matlab engine with the following command (generated using cmake) c++ -mmacosx-version-min=10.6 -bundle -headerpad_max_install_names -o library.so library.o /Applications/MATLAB_R2009b.app/bin/maci64/libeng.dylib /Applications/MATLAB_R2009b.app/bin/maci64/libmx.dylib -framework P...

Network Packet Inspector in Mac OSX

I'm trying to create a network packet inspector. I know you can do this with libpcap, but it's not a sniffer, i need to forge network packet, before it was sent on network. (sending via socks server) I found 2 ways to do this : Using an NKE. (Network Kernel Extension) Using a DYLD_INSERT_LIBRARIES to insert a library to hook network...

dylib @executable_path path issue in a plug-in bundle

Hi, I am developing a plug-in bundle, say MyPlugIn.bundle for an application, say BigApp.app. This bundle requires a dylib, say MyPlugIn.bundle/Contents/Resources/library.dylib. I have relocated paths for library.dylib, as I would have done for a simple application bundle: $ otool -L MyPlugIn.bundle/Contents/MacOS/MyPlugIn MyPlugIn.bun...

Finding dylib version using dlopen

Is there a way to find the version of a dylib using its path? I am looking for something that accepts the same arguments as dlopen. I have looked at NSVersionOfRunTimeLibrary, but from my reading of the documentation it looks like it gets the version of the current dylib, not the one specified in the path. Thank you ...

dylib for iPhone 3.1.2 is too short, wrong cputype/cpusubtype.

I've been trying to compile a dylib to use in a little prototyping experiment however dlopen() says that my dylib is Mach-O but that the file is too short. Should it be padded with something? I have the latest everything so that shouldn't be a problem. lipo spits this out when I try to merge the i386 and armv6 arch's together: lipo: s...

dyld: Library not loaded error when running command in terminal

Hi, When running some commands in the terminal, I get the following error message dyld: Library not loaded: /opt/local/lib/libjpeg.62.dylib Referenced from: /opt/local//lib/libTIFF.dylib Reason: no suitable image found. Did find: /opt/local//lib/libjpeg.62.dylib: can't map /opt/local/lib/libjpeg.62.dylib: can't map Trace/B...