[Openmcl-devel] FFI usage questiony

Gary Byers gb at clozure.com
Tue Sep 6 02:21:48 UTC 2005



On Mon, 5 Sep 2005, Hamilton Link wrote:

> I am not a C compilation genius, possibly someone else who has done this can 
> help me out.
>
> I need .so files or some such in order to pull in libraries with openmcl, 
> right?   On Mac OS X as far as I can tell the -shared argument to gcc isn't 
> supported... and that's what this 'Gandalf' library is trying to use when I 
> build it.  I can probably change the scripts, but what in the world would I 
> change it *to*?
>

Darwin supports two different types of shared libraries.  Shared libraries
of type "dylib" can be linked against and can also be opened at runtime,
but can't be closed/unloaded.  Shared libraries of type "bundle" (not
to be confused with the use of the term "bundle" to describe, e.g., an
application bundle) can be loaded and unloaded dynamically.  (I believe
that it's the case that every time you try to open one, you get a brand
new instance of the library mapped into your address space.)

There are probably several ways to create either kind.  One way that
works is:

shell> cc -c foo.c		# produces foo.o
shell> ld -dylib -o foo.dylib foo.o  # creates a dylib
shell> file foo.dylib
foo.dylib: Mach-O dynamically linked shared library ppc

shell> ld -bundle -o foo.bundle foo.o
shell> file foo.bundle
foo.bundle: Mach-O bundle ppc


> After I have a dynamically linkable thing under OS X, and install it, I 
> suspect I will have a .so file sitting somewhere and .h files sitting 
> installed elsewhere.  Then I think I can make the appropriate populate.sh 
> files and do the incantations needed to open up a new library.

Yes.  There's a fairly new version of the interface translator in the
testing directory.

>
> Thanks.
> h
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list