[Openmcl-devel] FFI usage question

Hamilton Link hamlink at cs.unm.edu
Mon Sep 5 20:49:35 PDT 2005


Well, that wasn't so bad. Here is what I'm doing, for posterity and for 
anyone who doesn't want to go and implement their own eigenvector 
decomposition routines (etc). Mind you I haven't actually called any 
functions in it, but if anyone has need of a linear algebra library I 
was able to build Gandalf ( 
http://gandalf-library.sourceforge.net/index.html ) in the terminal in 
Mac OS X.

The magic required was to do the rename of configure_macosx.h to 
configure.h (as per gandalf's INSTALL file), and tweak the contained 
libtool to point to the right pathname for sed, and to change a couple 
of lines invoking the compiler from using -shared and -soname arguments 
to be as follows:

archive_cmds="\$CC -bundle \$libobjs \$deplibs \$compiler_flags -o 
\$lib"
archive_expsym_cmds="\$CC -bundle \$libobjs \$deplibs \$compiler_flags 
\${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib"

And sure enough, when it finished I ended up with a libgandalf.so.1.1.1 
that is a Mach bundle.  Just for kicks I will post to the list if I 
successfully use any of its API. :)

Thanks for all the help, to Steve and Gary.

h

On Sep 5, 2005, at 8:21 PM, Gary Byers wrote:

>
>
> 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