Bug 11478 – shared library on osx: worked in 2.062, fails in 2.063.2, still fails in 2.064
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
Mac OS X
Creation time
2013-11-09T00:16:00Z
Last change time
2014-02-18T09:17:22Z
Keywords
bounty, pull
Assigned to
code
Creator
thelastmammoth
Comments
Comment #0 by thelastmammoth — 2013-11-09T00:16:01Z
----
module foo;
import std.stdio;
extern(C) void foo1(){ printf("ok\n");}
----
module main2;
pragma(lib,"foo");
extern(C) void foo1();
void main(){foo1;}
----
dmd -oflibfoo.dylib -shared foo.d;
dmd -L-L. main.d
./main
--output:
2.062:
OK
2.063(and 2.063.2):
sh: line 3: 92704 Segmentation fault: 11 ./main (cf Issue 10440)
2.064
Shared libraries are not yet supported on OSX. //pull
sh: line 3: 92736 Segmentation fault: 11 ./main
Issue 10440 was closed as 'RESOLVED FIXED' but I don't see how it addresses the problem. I understand shared libs were not officially completely supported in 2.062 however I *was* able to build usable apps built around D plugins (with Runtime.initialize etc), notably a REPL based on shared libs. Since upgrading from 2.062, I can't use those.
Please revert old behavior even if behavior is partial.
(In reply to comment #5)
> This still fails. it only works when adding import core.runtime inside 'foo.d'
So it crashes if you don't import core.runtime?
This might be an ODR problem, i.e. when statically linked into the dylib and the exe druntime can't work correctly.
> (but then still prints:
> Shared libraries are not yet supported on OSX
It's supposed to print that, because shared libraries aren't yet supported on OSX.