Undefined references when linking to C library
Peter Federighi
pfederighi at yahoo.com
Thu Dec 23 16:28:16 PST 2010
wrzosk wrote:
> I've had simmilar issue a few days ago. The problem is that global values from C
should be marked shared in D
> extern int val; -> extern (C) shared int val;
> or maybe __gshared. Both makes linking stage finishes with success.
Jerome M. Berger wrote:
> I think gpm_zerobased, _bpm_buf and _gpm_arg should be declared __gshared.
Indeed. So I added a bunch of "__gshared"s to all the variables and it compiles
and links. Yah! I just have to remember to declare handler functions with extern
(C), otherwise the program will segfault once the handler returns.
Where should I post/upload the files that I converted? There are a whole two of
them: One is gpm.h which is specific to libgpm. The other is paths.h which I was
surprised to find not already available. I would assume that it should be
available as std.c.linux.paths or core.sys.posix.paths. Also, should the files
end with .d or .di I may be the only person who wants to use libgpm with D, but I
figure it should be available just in case.
Thank you all for your help.
- Peter Federighi
More information about the Digitalmars-d-learn
mailing list