Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] Custom linking with MacOSX frameworks?

2 views
Skip to first unread message

Julien Blond

unread,
Oct 3, 2006, 7:11:54 AM10/3/06
to caml...@inria.fr
Hello,

Is it possible to make a custom executable linked with some MacOSX
framework like Cocoa or AppKit? If it is, how can it be done?

Thanks,

-- Julien

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Christophe Raffalli

unread,
Oct 3, 2006, 10:07:34 AM10/3/06
to Julien Blond
Julien Blond a écrit :

> Hello,
>
> Is it possible to make a custom executable linked with some MacOSX
> framework like Cocoa or AppKit? If it is, how can it be done?
>

I do that for GlSurf and I use Glut ! The window has an acqua look, but no way to customize the
menubar ...


> Thanks,
>
> -- Julien
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

--
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christoph...@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature. The public key is
stored on www.keyserver.net
---------------------------------------------

Julien Blond

unread,
Oct 3, 2006, 11:06:03 AM10/3/06
to Christophe Raffalli
> I do that for GlSurf and I use Glut !

Cool! I took a look at your Makefile and I found the answer to my
question.
Actually I didn't think to pass the -framework <name> with the double
quotes to the C compiler.

So, if this compilation issue does interest somebody, here is the
"trick". To "custom link" with MacOSX frameworks, the compilation
command must looks like :

ocamlc -custom <files needed> -o <executable name> -cclib -lobjc -
ccopt "-framework <name>" ...

Thanks to Cristophe! :-)

> The window has an acqua look, but no way to customize the menubar ...

Well, I don't use Glut for I prefer the more "customizable" SDL
framework. It may work better with it?

-- Julien Blond
LIP6/Bertin Technologies

Christophe Raffalli

unread,
Oct 3, 2006, 3:49:27 PM10/3/06
to Julien Blond
Julien Blond a écrit :

>> I do that for GlSurf and I use Glut !
>
> Cool! I took a look at your Makefile and I found the answer to my
> question.
> Actually I didn't think to pass the -framework <name> with the double
> quotes to the C compiler.
>
> So, if this compilation issue does interest somebody, here is the
> "trick". To "custom link" with MacOSX frameworks, the compilation
> command must looks like :
>
> ocamlc -custom <files needed> -o <executable name> -cclib -lobjc
> -ccopt "-framework <name>" ...
>
> Thanks to Cristophe! :-)
By the way if someone know which framework to use to compile camlimages
with the maximum number of file format without depending upon fink
library ...

>> The window has an acqua look, but no way to customize the menubar ...
>
> Well, I don't use Glut for I prefer the more "customizable" SDL
> framework. It may work better with it?
>
Which binding ? I might give it a try ? By customizable, you mean access
to the OS X menu bar ?

Shivkumar Chandrasekaran

unread,
Oct 3, 2006, 4:21:18 PM10/3/06
to Christophe Raffalli

On Oct 3, 2006, at 12:47 PM, Christophe Raffalli wrote:
> By the way if someone know which framework to use to compile
> camlimages with the maximum number of file format without depending
> upon fink library ...

On my machine the Mac image libraries seem to be at:

/System/Library/Frameworks/ApplicationServices.framework/Versions/A/
Frameworks/ImageIO.framework/Versions/A/Resources/

I can see TIFF, PNG, JPEG and GIF libraries in there.

--shiv--

PS: I am not sure which framework you want to specify though: ImageIO ?

Daniel Bünzli

unread,
Oct 3, 2006, 6:38:02 PM10/3/06
to Christophe Raffalli

Le 3 oct. 06 à 21:47, Christophe Raffalli a écrit :

> By the way if someone know which framework to use to compile
> camlimages with the maximum number of file format without depending
> upon fink library ...

There is the ImageIO.framework.

> cd /System/Library/Frameworks/ApplicationServices.framework/
Frameworks/ImageIO.framework/Resources/
> ls *.dylib
libGIF.dylib* libJPEG.dylib*
libPng.dylib* libRaw.dylib*
libJP2.dylib* libOpenEXR.dylib*
libRadiance.dylib* libTIFF.dylib*

But header files are not included (these libraries are used to
implement an osx specific abstraction). Moreover, by looking at the
output of

> otool -T -v *.dylib

it seems to me that not every symbol defined by these libraries are
exported.

>> Well, I don't use Glut for I prefer the more "customizable" SDL
>> framework. It may work better with it?
> Which binding ? I might give it a try ? By customizable, you mean
> access to the OS X menu bar ?

ocamlsdl I guess. IIRC you don't have access to the menu bar in SDL
apps. But you don't have inversion of control -- you own the main
loop -- maybe that's what he meant by more "customizable". Compared
to glut, a limitation you get is that you can have only one window to
render (this limitation will be lifted in the upcoming version 1.3).

Daniel

Doug Kirk

unread,
Oct 4, 2006, 12:37:07 PM10/4/06
to Daniel Bünzli
Try checking

/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework/Headers/Image*.h

for the headers.

If you don't want to depend upon fink, and neither on OS X core libraries,
maybe ImageMagick?

Daniel Bünzli

unread,
Oct 4, 2006, 1:31:23 PM10/4/06
to Doug Kirk
Le 4 oct. 06 à 18:33, Doug Kirk a écrit :

> Try checking
>
> /System/Library/Frameworks/ApplicationServices.framework/Headers/
> ApplicationServices.h
> /System/Library/Frameworks/ApplicationServices.framework/Frameworks/
> ImageIO.framework/Headers/Image*.h
>
> for the headers.

These headers are those of the osx specific image loading
abstraction. Camlimages doesn't use this abstraction so there is no
chance you'll be able to compile camlimages using these headers. What
you want is png.h, jpeglib.h, tiff.h, etc. Anyway as I told in my
previous email it seems that the dynamic libraries in imageio do not
include all the functions you get when you compile the corresponding
library by yourself, so they aren't really usefull by their own.

> If you don't want to depend upon fink, and neither on OS X core
> libraries, maybe ImageMagick?

Doesn't really make more sense. First you can use libpng without
depending on fink, then iirc camlimage doesn't use ImageMagic at all.

The only real option in my opinion is to statically link against the
image libraries to distribute your application.

Best,

Christophe Raffalli

unread,
Oct 4, 2006, 4:57:43 PM10/4/06
to Daniel Bünzli
Daniel Bünzli a écrit :

> Le 4 oct. 06 à 18:33, Doug Kirk a écrit :
>
>> Try checking
>>
>> /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h
>>
>> /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework/Headers/Image*.h
>>
>>
>> for the headers.
>
> These headers are those of the osx specific image loading abstraction.
> Camlimages doesn't use this abstraction so there is no chance you'll
> be able to compile camlimages using these headers. What you want is
> png.h, jpeglib.h, tiff.h, etc. Anyway as I told in my previous email
> it seems that the dynamic libraries in imageio do not include all the
> functions you get when you compile the corresponding library by
> yourself, so they aren't really usefull by their own.
>
>> If you don't want to depend upon fink, and neither on OS X core
>> libraries, maybe ImageMagick?
>
> Doesn't really make more sense. First you can use libpng without
> depending on fink, then iirc camlimage doesn't use ImageMagic at all.
>
> The only real option in my opinion is to statically link against the
> image libraries to distribute your application.
>
You can an applescript OS X application with the library and the
executable inside the app folder ... This is basically the same anyway.
0 new messages