digitalmars.D.learn - Static library building
- Vindex (20/20) Mar 19 2018 'main.d':
- Adam D. Ruppe (9/10) Mar 19 2018 It still needs to know where to find the import file to get D
- Vindex (3/13) Mar 19 2018 Thank you. Sorry, the library does not save the requested
'main.d': import pack.mod; void main() { fn("Hello"); } 'mod.d': module pack.mod; void fn(string s) { import std.stdio; writeln("Hello"); } Both files are in the same directory. So all is well: dmd main.d mod.d So all is bad: dmd mod.d -lib dmd main.d -L-L. -L-l:mod.a main.d(1): Error: module mod is in file 'pack/mod.d' which cannot be read Please answer why it happens.
Mar 19 2018
On Monday, 19 March 2018 at 14:07:52 UTC, Vindex wrote:dmd main.d -L-L. -L-l:mod.aIt still needs to know where to find the import file to get D information like names and types out of it that aren't in the lib (well they sorta are but not exactly, in any case it isn't implemented to try it now). So either still pass it mod.d there, which makes the library useless, or pass `-Isomething` where there's a `pack/mod.d` or `pack/mod.di` file with the function prototypes. dmd -H can make mod.di out of mod.d for you in some cases automatically.
Mar 19 2018
On Monday, 19 March 2018 at 14:31:05 UTC, Adam D. Ruppe wrote:On Monday, 19 March 2018 at 14:07:52 UTC, Vindex wrote:Thank you. Sorry, the library does not save the requested information.dmd main.d -L-L. -L-l:mod.aIt still needs to know where to find the import file to get D information like names and types out of it that aren't in the lib (well they sorta are but not exactly, in any case it isn't implemented to try it now). So either still pass it mod.d there, which makes the library useless, or pass `-Isomething` where there's a `pack/mod.d` or `pack/mod.di` file with the function prototypes. dmd -H can make mod.di out of mod.d for you in some cases automatically.
Mar 19 2018