Undefined references when linking to C library

"Jérôme M. Berger" jeberger at free.fr
Thu Dec 23 13:38:20 PST 2010


Peter Federighi wrote:
> Jonathan M Davis wrote:
>> Did you wrap the C declarations in an extern(C) block? Without that, it's going
>> to think that your variables are D variables not C variables. The same goes for
>> any functions - _especially_ for the functions. In fact, a large portion of - in
>> not all of - your gpm.d file should likely be in extern(C).
> 
> I tried "extern (C)" for the whole module and individually.  I get the following
> error:
> /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld:
> _gpm_arg: TLS reference in gev.o mismatches non-TLS definition in
> /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib/libgpm.so section .data
> /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib/libgpm.so: could not read
> symbols: Bad value
> collect2: ld returned 1 exit status
> --- errorlevel 1
> 
> Is this a 32/64 bit issue?  I have both versions of libgpm installed.  Those file
> paths are obtuse, but they do point to the 32 bit libraries.  I've successfully
> compiled other programs that use C libraries such as SDL and OpenGL (both via the
> Derelict2 modules).
> 
	I think gpm_zerobased, _bpm_buf and _gpm_arg should be declared
__gshared.

		Jerome
-- 
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20101223/d4889f1c/attachment.pgp>


More information about the Digitalmars-d-learn mailing list