digitalmars.D.ldc - Compile without standard library
- Ragmaanir (11/11) Nov 20 2015 Hi,
- Timo Sintonen (10/22) Nov 21 2015 You can not use D without the runtime library.
- David Nadlinger (4/10) Nov 21 2015 Try adding "pragma (LDC_no_moduleinfo);" to the modules that you
- David Nadlinger (10/12) Nov 21 2015 I should add that this will only help with the _d_dso_registry
- Kagamin (5/6) Nov 21 2015 What simple can be done in your case:
- Kagamin (5/5) Nov 21 2015 To clarify: the difference between structs and classes in D is
- Ragmaanir (8/8) Nov 23 2015 @Timo Sintonen, @David Nadlinger, @Kagamin
Hi, i want to compile D-code for an experimental OS. But when i run the build script i get several compilation/linkage errors: https://gist.github.com/Ragmaanir/17a6b49ad6c1725aafa1 It looks like this is some d-internal stuff. What can i do to fix this? I have written some of my experiments in c++ previously and that works, but i want to port it to D because i think i will be more productive and less annoyed by the syntax. But this problem blocks me from doing so and i'm not sure about how to fix that. Thanks!
Nov 20 2015
On Friday, 20 November 2015 at 21:54:12 UTC, Ragmaanir wrote:Hi, i want to compile D-code for an experimental OS. But when i run the build script i get several compilation/linkage errors: https://gist.github.com/Ragmaanir/17a6b49ad6c1725aafa1 It looks like this is some d-internal stuff. What can i do to fix this? I have written some of my experiments in c++ previously and that works, but i want to port it to D because i think i will be more productive and less annoyed by the syntax. But this problem blocks me from doing so and i'm not sure about how to fix that. Thanks!You can not use D without the runtime library. You can make an empty library and add required functions. Look at Mikes examples at https://github.com/jinshil. With this you can write C like programs but you can not for example have any oo related things like classes. To use more D features you need a modified runtime, something like mine at https://bitbucket.org/timosi/minlibd. These projects are both for Arm microcontrollers and gdc but you get the idea.
Nov 21 2015
On Friday, 20 November 2015 at 21:54:12 UTC, Ragmaanir wrote:It looks like this is some d-internal stuff. What can i do to fix this? I have written some of my experiments in c++ previously and that works, but i want to port it to D because i think i will be more productive and less annoyed by the syntax. But this problem blocks me from doing so and i'm not sure about how to fix that.Try adding "pragma (LDC_no_moduleinfo);" to the modules that you want to use without a runtime. — David
Nov 21 2015
On Saturday, 21 November 2015 at 12:27:22 UTC, David Nadlinger wrote:Try adding "pragma (LDC_no_moduleinfo);" to the modules that you want to use without a runtime.I should add that this will only help with the _d_dso_registry calls, but not the TypeInfo references. We'd be happy to accept patches that add a command line flag or similar to disable all the druntime dependencies. There is no technical reason for not doing so (although you won't be able to use exceptions, garbage collection, etc.) – it's a simple case of the current contributors not getting around to doing so yet. — David
Nov 21 2015
On Friday, 20 November 2015 at 21:54:12 UTC, Ragmaanir wrote:https://gist.github.com/Ragmaanir/17a6b49ad6c1725aafa1What simple can be done in your case: 1. stub _d_dso_registry 2. implement _d_assert_msg, it's useful even if it's just halts 3. don't use classes if possible, it's just easier without them
Nov 21 2015
To clarify: the difference between structs and classes in D is that structs can't inherit and can't have virtual methods, looks like you don't use polymorphism in your C++ code, so just declare the types as structs. BTW your String layout matches that of D string except that D uses size_t for string length :)
Nov 21 2015
Timo Sintonen, David Nadlinger, Kagamin Thank you for your comments! I guess i will stick with C++(11/14) then for now. I dont have enough time/knowledge in order to submit any patches to D in this area. Maybe i will give D a try later, i think it has several very useful features that i will probably miss in C++ ^^ But for now i guess it is easier for me to just stick with C++. Thanks!
Nov 23 2015