DenVdmj / xdelta

Automatically exported from code.google.com/p/xdelta (actual: https://github.com/jmacd/xdelta-devel/)
0 stars 0 forks source link

shared library #80

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I need to link against xdelta using the C ABI from other languages (Haskell
in this case). Could you add to the Makefile so that a shared library is
produced - there seems to be something there already, but it looks very
python based. Something like the following seems to work for me:

xdelta3.so: $(SOURCES)
    $(CC) $(CFLAGS) -fPIC -O3 xdelta3.c -lm -shared -o xdelta3.so \
          -DGENERIC_ENCODE_TABLES=0 \
          -DREGRESSION_TEST=1 \
          -DSECONDARY_DJW=1 \
          -DSECONDARY_FGK=1 \
          -DXD3_DEBUG=0 \
          -DXD3_MAIN=1 \
          -DXD3_POSIX=1 \
          -DXD3_USE_LARGEFILE64=1

(i.e. exactly the same as the xdelta3 target but with -shared and -fPIC)

I'm not sure if there are other things that need changing too - C and GCC
aren't really my strong points!

Original issue reported on code.google.com by matthew....@gmail.com on 12 Nov 2008 at 3:07

GoogleCodeExporter commented 9 years ago
ok, that should also -o libxdelta3.so
and it would seem that "static" needs to come off functions in the xdelta3.h 
file
which should be exported (eg xd3_set_flags)

Original comment by matthew....@gmail.com on 12 Nov 2008 at 4:05

GoogleCodeExporter commented 9 years ago
I would also like to link to the C api from a C++ application. I'm guessing the
above is what I need?

I tried to put that in my Makefile, but when I try make xdelta3.so I get:
make: Nothing to be done for `xdelta3.so'.

Any ideas? (I also added it to the TARGETS list) I can't seem to find a build
libxdelta3.so anywhere in the directory/subdirs.

Original comment by Andrew.S...@gmail.com on 1 Mar 2009 at 3:19

GoogleCodeExporter commented 9 years ago
Messing with things for a while, I discovered that I:

a: Need to 'extern "C" { #include "xdelta3.h" }
b: Need to build with XD3_MAIN=0

It seems like things are actually linking now. Time to code up some tests

Original comment by Andrew.S...@gmail.com on 1 Mar 2009 at 4:29

GoogleCodeExporter commented 9 years ago
I once used automake and autoconf to create non-Windows releases, but I hated 
it.  I
made efforts for xdelta3 to be the simplest to build for this reason, it's just 
one
compilation unit.

Original comment by josh.mac...@gmail.com on 28 Oct 2009 at 3:40