objective c - How to convert Obj-C code into a library -


i have 3 apps written in obj-c want modify , convert libraries, can use them in monotouch app.

where find docs tell me how take obj-c code , turn libraries?

imagine have file called lib1.m

you first have compile object code. instance:

gcc -wall -framework cocoa -o lib1.o lib1.m 

that create lib1.o

then you'll have decide wether want static or dynamic library.

to build static library, you'll need library object first:

glibtool --quiet --mode=compile gcc -o lib1.lo -c lib1.c 

then can create static library library archive:

glibtool --quiet --mode=link gcc -o lib1.la -c lib1.lo 

to build dynamic library:

libtool -dynamic -flat_namespace -lsystem -undefined suppress -macosx_version_min 10.6 -install_name /usr/local/lib/lib1.dylib -o lib1.dylib lib1.o 

note dynamic libraries, must provide install path when creating library.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -