Bug 13287 – Plugin can't access its moduleinfo in constructors

Status
NEW
Severity
normal
Priority
P3
Component
druntime
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2014-08-12T10:05:56Z
Last change time
2024-12-07T13:34:09Z
Assigned to
No Owner
Creator
Johannes Pfau
Moved to GitHub: dmd#17133 →

Comments

Comment #0 by johannespfau — 2014-08-12T10:05:56Z
load.d --------------- import core.runtime, std.stdio; void main(string[] args) { auto name = args[0]; assert(name[$-5 .. $] == "/load"); name = name[0 .. $-4] ~ "lib.so"; writeln("laoding" ~ name); Runtime.loadLibrary(name); } --------------- test.d --------------- module test; import std.stdio; shared static this() { bool found = false; foreach(minfo; ModuleInfo) { if(minfo.name == "test") found = true; } writeln("Found: ", found); } --------------- dmd test.d -shared -oflib.so -fPIC -defaultlib=libphobos2.so -L-rpath=./linux/lib64/ -L-L./linux/lib64/ dmd load.d -defaultlib=libphobos2.so -L-rpath=./linux/lib64/ -L-L./linux/lib64/ LD_LIBRARY_PATH=. ./load laoding./lib.so Found: false Tested with dmd 2.065.0 This is actually a problem because std.encoding actually does use moduleinfo in its constructor. In GDC we'll probably ship libgdrutime.so and libgphobos.so. If the main program now does not link against libphobos and loads a plugin which links against libphobos it'll trigger this bug.
Comment #1 by alphaglosined — 2022-12-15T09:28:31Z
Still happening as of 2.101.0.
Comment #2 by robert.schadek — 2024-12-07T13:34:09Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17133 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB