Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
June 10, 2015 [Issue 14674] Importing std.stdio causes another module to become undefined | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14674 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> --- (In reply to sigsve from comment #0) > When importing std.stdio in a specific context, causes an "undefined symbols for architecture" I'm on Windows so I need to guess what "undefined symbols for architecture" is. Maybe it's a linker error? As I can see the Rakefile, it does not compile and link the file src/collector/Stack.d. It would be the reason of linker error. D's import is not same with the #include in C. If you import a module, you also need to compile and link it normally. -- |
June 10, 2015 [Issue 14674] Importing std.stdio causes another module to become undefined | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14674 --- Comment #2 from sigsve <sigurdbergsvela@gmail.com> --- My apologies for being vague, I was hoping you'd have a Mac available. It is definitely a linking error(This is the error I get): Undefined symbols for architecture x86_64: "_D5Stack12__ModuleInfoZ", referenced from: _D4Main12__ModuleInfoZ in Main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) But, as said, this error only shows if I include std.stdio in the Stack.d file -- |
June 10, 2015 [Issue 14674] Importing std.stdio causes another module to become undefined | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14674 --- Comment #3 from sigsve <sigurdbergsvela@gmail.com> --- Although, you are right. Sorry, I though DMD compiled and linked Stack.d automagically(Which it seems to have done, when I do not import std.stdio) But when I compile each file separately to .o files, and link them, it works. -- |
June 10, 2015 [Issue 14674] Importing std.stdio causes another module to become undefined | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14674 --- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> --- (In reply to sigsve from comment #2) > Undefined symbols for architecture x86_64: > "_D5Stack12__ModuleInfoZ", referenced from: > _D4Main12__ModuleInfoZ in Main.o > ld: symbol(s) not found for architecture x86_64 > clang: error: linker command failed with exit code 1 (use -v to see > invocation) It says a ModuleInfo symbol of Stack module is missing. (In reply to sigsve from comment #3) > Sorry, I though DMD compiled and linked Stack.d automagically(Which it seems to have done, when I do not import std.stdio) If you don't list a module file in dmd command line, the symbols in it are compiled (== semantic analysis done) but those code won't be output to any object files. When you don't add `import std.stdio;` in Stack.d, today's dmd fortunately determines the ModuleInfo object of Stack module is unnecessary, so the build will succeed. However it's just undocumented behavior, and might be changed in the future. So I'd recommend to compile and link Stack.d always when you import it from other modules. -- |
July 21, 2017 [Issue 14674] Importing std.stdio causes another module to become undefined | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14674 Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Hardware|x86_64 |All Resolution|--- |INVALID OS|Mac OS X |All --- Comment #5 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> --- Closing per Kenji's wonderful explanation above. -- |
Copyright © 1999-2021 by the D Language Foundation