help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking to external static (!) library


From: John W. Eaton
Subject: Re: Linking to external static (!) library
Date: Wed, 20 Apr 2011 11:16:34 -0400

On 20-Apr-2011, TOT wrote:

| I agree - but do I have any octave based solution for my problem?

I think the problem is that you are trying to do something that is not
possible on your operating system.  You apparently can't create a
dynamically loadable shared library unless all the parts are compiled
as position independent code.  I don't see that this problem is
specific to Octave.

Have you considered the following options?

Recompile your library with -fPIC.  You say that's hard because of
some horrible build environment.  But I suppose it is possible to
compile the library with default options hard-wired into the build
scripts, right?  Then perhaps you could write shell scripts that have
the same names as the compiler but appear earlier in your PATH, and
have these scripts invoke the real compiler with -fPIC added to the
list of options.  Then when you build your library as usual, but this
time the scripts should take care of adding the -fPIC option you need.

If that fails for some reason, then another option would be to write a
completely separate program that calls the functions you need from
your library.  To pass data to/from this program, have it read an
input file and write and output file.  Then write a .m file for Octave
that prepares the input file, invokes the program with the system
function and then reads the output file created by your separate
program.  If you don't like the idea of files, you could use pipes
instead and have your program read from stdin and write to stdout.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]