Can't figure out segfault

Mike Wey mike-wey at example.com
Wed Mar 2 11:26:28 PST 2011


On 03/02/2011 01:49 AM, rm wrote:
> I put together bindings for DevIL in D to use on a school assignment.  The
> bindings (attached) work fine on Windows, but cause a segfault on Linux when I
> call ilInit.
>
> this can be demonstrated by a little test program
>
> "
> import graphics.bindings.devil;
>
> public void main(string[] args)
> {
>     ilInit();
> }
> "
> compiled with "dmd -L-ldl test.d devil.d" where test.d is the above program
> and devil.d is attached.
>
> When run, this program segfaults, but if lines 112,113,165,166 of devil.d are
> commented out, the program works fine, and I can't figure out what the problem
> with those lines is.  The fact that this works on Windows confuses me even more.
>
> Any help would be appreciated.

On linux the linker is called with --export-dynamic by default and this 
tells the linker to export all the symbols pressent in your executable.
So it is posible that dlsym is returning the address of the symbols in 
your execuable.
Thunderbird is having some problems with your attachment so i'm not able 
to test, but renaming the functions should do the trick.

-- 
Mike Wey


More information about the Digitalmars-d-learn mailing list