.dll Equivalent on Mac OS X [duplicate] - objective-c

This question already has answers here:
How do third-party libraries work in Objective-C and Xcode?
(4 answers)
Closed 9 years ago.
I am from a Windows background and I am used to creating SDKs by creating (.dll)s and then distributing all the libraries and Documentation.
So, if a user wants to use it, he adds a reference to the library and uses it. However, in a Mac, I am working on a SDK and I want a way of creating and distributing Mac libraries.
(I want to create the library in Objective-C)
Please help me :)

If you're creating a Mac library, you have either the option of creating a dylib, which includes only the compiled binary for the library, or creating a framework, which includes the compiled binary as well as headers and other bundle resources used by the library, in a single package. Frameworks are the preferred method of library distribution for the Mac.
If you're creating an iOS library, iOS doesn't support dynamic libraries of any kind (no dylibs or frameworks) so you're stuck with creating static libraries to distribute your code.

Both Mac and iOS have Dynamicly Linked Libraries. They just are not called that. They are generally just referred to as Shared Libraries and they typically are wrapped in Frameworks.
Unfortunately, iOS limits the use of Shared Libraries to System Libraries and does not allow installing shared libraries on non-jailbroken devices.
Both platforms also support Static Libraries.

Related

iOS: staic framework and dynamic framework?

Recently, I decide to make a framework for login module. I add the image resources to the framework, but I could not get it by code. I change the build the setting. mach-o type static library into dynamic library. I can get the image.
It is easier to make a moudle with dynamic framework than static framework.
but I google and find the dynamic framework made by developer is different with the Apple's dynamic framework. the app contain custom dynamic framework can not upload to Appstore ? Is it true?
who can answer my question? Thank you so much!!!
Dynamic frameworks are extremely common in AppStore apps. What you're probably seeing in posts is that you cannot manually load frameworks at runtime on iOS (i.e. there's no access to dlopen). They all have to be loaded at link time. You also cannot ship "shared" frameworks, where multiple apps share a single copy (like Apple's system frameworks). Each app must contain all of its custom frameworks.
But you can certainly ship dynamic frameworks in your bundle.

Loading arm-shared-libs in Marmalade SDK

Marmalade SDK supports making projects to generate arm-shared-libs. It also supports loading "libraries" via its s3eLibraryOpen(). However these seem to only be able to open x86 PE images that can also be generated with Marmalade SDK, but obviously as soon as I get a symbol and try calling the function it will crash since it's x86 and the calling process is ARM.
So just to re-iterate, the question is: Is there any support in Marmalade SDK for dynamically loading arm shared libraries at runtime?
s3eLibraryOpen will allow you to load dynamic libraries on platforms that support it as as well as the dynamic library built for that platform Android (.so),Windows(.dll) , IOS does not support it.

Build static library in monotouch

Is it possible to build a static library using MonoTouch that can be used by Xcode developers? What about the headers?
I come from a C# background and I have a large library to port over to iOS.
It'd save me oodles of time if I could keep it in C# and adjust as needed.
AFAIK it is not possible. See here:
MonoTouch: talking from Obj-C to MonoTouch
Which links to a project that tries to do what you want:
http://www.guidebee.biz/forum/redirect.php?fid=16&tid=176&goto=nextoldset

Cocos2d Targeting iPhone/iPad/Mac

I recently did some research on making a cocos2d app for iPhone/iPad AND Mac. I have done the iPhone/iPad route but have never done it with a Mac target. It appears that some people have added it as a target but mentioned that it is finicky and others have suggested making a separate Cocos2d Mac project that uses the same files. Any wisdom to impart here?
I believe it is absolutely crucial to have both iOS and Mac targets in the same project. Otherwise you'll spend too much time keeping one platform in synch with the other, until eventually you either manage to create a good (but still time-consuming) workflow - or end up neglecting one of the two platforms.
Ideally the code base should make as little use as possible of compiler macros. You'll want to compile both iOS and Mac code even if it's not being used for one platform. So having some classes or methods that are #ifdef'ed to Mac, others to iOS, will more often than not lead to compile errors when you switch targets. That means wrapper classes, so that you can write the same code regardless of the platform, are essential.
Right now, Cocos2D doesn't offer you to create iOS & Mac targets in the same Xcode project. The way to get there isn't immediately obvious either, because each target requires its own build settings for: Base SDK, SDK Root, Deployment Target, Architectures and possibly Compiler version. It gets worse if you also want to use 3rd party libraries (Box2D, Chipmunk, etc) because in some cases you'll be forced to create iOS and Mac specific targets for those libraries as well - if only to ensure that the library is built with the same compiler as the project's target, otherwise you can run into the strangest build or runtime issues.
I've had issues getting these platform specific targets to work within a single Xcode project without Xcode complaining or otherwise misbehaving. I haven't tried it with Xcode 4.1 and 4.2. By that time I had created .xcconfig files to host the build settings. The .xcconfig files may or may not be necessary with the more recent Xcode versions but they definitely make managing multiple platform-specific targets easier.
Long story short, the best and easiest way to do cross-platform development with cocos2d-iphone is by using Kobold2D.
Most of the 15 template projects have an iOS and Mac target in each project, you just need to select the corresponding scheme, then hit build & run. The most commonly needed platform-specific code (processing user input) is wrapped in a platform-agnostic, simple to use wrapper class KKInput.
Disclaimer: I'm the developer of Kobold2D. There's a slim chance that I may be biased. You should try Kobold2D anyway. :)

Maemo / Symbian and external libraries

How can I know, whether an external library can be compiled to work on a different platform? the library for instance is tesseract-ocr
And if it possible, how do I do this?? (Basically I would like to create a Qt application that uses this library)
To find out, try building the library yourself. At the moment your question is quite broad. Post new questions when you have something more specific to ask.
If building the library fails, it is most probably due to some unsupported dependencies that you need to port first yourself.
Porting to Maemo is probably straightforward as it is a Debian-based environment and supports all the build tools such as autotools.
Symbian doesn't have autotools. Perhaps the fastest way to get started there is to first configure and build the library on e.g. cygwin and then generate the required bld.inf and .mmp files to build it on Symbian.
You can link your Qt application to regular C/C++ libraries. Just include the necessary header files in your code and link to the library using LIBS += -lfoo in your .pro file.