http://d.puremagic.com/issues/show_bug.cgi?id=6012


Jakob Bornecrantz <wallbra...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #3 from Jakob Bornecrantz <wallbra...@gmail.com> 2011-05-15 
19:15:09 PDT ---
Ugh sorry for wasting your time. This is mostly my fault, it turns out that dmd
1.064 added "-L--export-dynamic" to DFLAGS.

Say a library Bar have a function called barFunc, now my bindings to the C
libraries looked something like this:

extern (C) void (*barFunc)();

Which I then loaded with a library loader functions for that platform.

Now lets say library Foo is linked in and it uses function barFunc. The binding
function in my program gets the symbol name _barFunc since its declared with
extern(C). This worked in the past as none of those functions where exported by
default, but when DMD 1.064 added "-L--export-dynamic" those pointers got
exported. And they get resolved before any of the other normal functions
causing the callee from Foo to jump to the pointer instead of the real
function.

Either I just remove the "-L--export-dynamic" from dmd.conf or change the
bindings to be this instead:

typedef extern (C) void function() pfn_BARFUNC;

pfn_BARFUNC barFunc;

Now barFunc gets a prober D symbol and things works again.

Cheers Jakob.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to