Re: Static library building

2018-03-19 Thread Vindex via Digitalmars-d-learn

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:

dmd main.d -L-L. -L-l:mod.a


It 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.


Thank you. Sorry, the library does not save the requested 
information.


Re: Static library building

2018-03-19 Thread Adam D. Ruppe via Digitalmars-d-learn

On Monday, 19 March 2018 at 14:07:52 UTC, Vindex wrote:

dmd main.d -L-L. -L-l:mod.a


It 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.


Static library building

2018-03-19 Thread Vindex via Digitalmars-d-learn

'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.