D with gmp via swig
Iain Buclaw
ibuclaw at ubuntu.com
Sun Aug 14 04:38:12 PDT 2011
== Quote from Oliver (oliver.ruebenkoenig at web.de)'s article
> Hello I am trying to get to a gmp interface for D2. I have some trouble to get
> that to work, however. Perhaps someone has an idea what I am doing wrong. I
> must admit I am not sure this is a D issue or a swig issue or something else.
> The interface file for swig
> cat gmpd.i
> %module gmpd
> %{
> #include "gmp.h"
> %}
> %include "gmp.h"
> A main with a call to gmpd
> cat main.d
> import std.stdio;
> import gmpd;
> void main() {
> writeln("Hello");
> }
> This is what I do then:
> /usr/local/swig-204/bin/swig -I/usr/include/ -d -d2 gmpd.i
> /opt/usr/local/bin/gdc -c main.d
> /opt/usr/local/bin/gdc -c gmpd.d
> /opt/usr/local/bin/gdc -c gmpd_im.d
> /opt/usr/local/bin/gdc -c gmpd_wrap.c
> /opt/usr/local/bin/gdc main.o -oa.out gmpd.o gmpd_im.o gmpd_wrap.o -lgmp
> I get messages of the type:
> /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld:
> __gmp_set_memory_functions: TLS definition in gmpd_im.o section .tbss
> mismatches non-TLS reference in gmpd_wrap.o
> gmpd_wrap.o: could not read symbols: Bad value
> collect2: ld returned 1 exit status
This will be a bug in swig. Whatever storage class it is setting
__gmp_set_memory_functions, it is wrong (I assume it should be defining it as
__gshared).
Regards
Iain
More information about the Digitalmars-d-learn
mailing list