[OpendTect_Developers] help with static libs

Bert Bril bert at opendtect.org
Fri Mar 18 11:35:32 CET 2011


Marcio:


> OWNC++FLAGS := lib/libMiniSicres.a

The key to getting this right is to try 'make -n' and see what commands
make comes up with. You'll see that the C++FLAGS are put before the link
libs, and I guess that's the problem here (the linker is not smart enough).

But even if you get the compilation working, loading into OpendTect
requires that the object code is available. This is not a shared lib but
an archive, which is not an executable unit, but just a collection of
objects. It needs to be included fully in the plugin's output shared
lib. By far the easiest is to use:

EXTRALIBSFORSHLIB := MiniSicres

That only requires that you put the libMiniSicres.a (or a link to it) in
lib/$(binsubdir)/G (or if you don't have $DEBUG set, 'O' at the end). If
you don't do that you'll get a message from the linker telling you that BTW.


In general, for archives (.a on Linux and Mac, .lib on Windows), use
EXTRALIBSFORSHLIB. For shared libs (.so (Linux), .dylib (Mac) and .dll
(Windows)) use EXTRALDLIBS.



/Bert

-- 
-- Bert Bril / OpendTect developer at dGB
-- mailto:Bert.Bril at opendtect.org , http://opendtect.org





More information about the Developers mailing list