Re: First module

2023-07-07 Thread Cecil Ward via Digitalmars-d-learn
On Friday, 7 July 2023 at 14:18:35 UTC, Richard (Rikki) Andrew 
Cattermole wrote:

1. Compiler reads in source code provided on cli
2. It gets parsed
3. imports get looked up, if not already read in, looks in the 
directories provided by -I based upon the full module + package 
import statement

4. Finish compilation
5. Linker gets passed object files to produce some artifact 
like an executable


Very rough idea of how it works, but will do for what you are 
asking about.


As long as you compile all at once, assume inlining will work 
if it thinks it should. Modules will not affect it.


Brilliant, thanks Rikki.


Re: First module

2023-07-07 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn

1. Compiler reads in source code provided on cli
2. It gets parsed
3. imports get looked up, if not already read in, looks in the 
directories provided by -I based upon the full module + package import 
statement

4. Finish compilation
5. Linker gets passed object files to produce some artifact like an 
executable


Very rough idea of how it works, but will do for what you are asking about.

As long as you compile all at once, assume inlining will work if it 
thinks it should. Modules will not affect it.


Re: First module

2023-07-07 Thread Cecil Ward via Digitalmars-d-learn

On Thursday, 6 July 2023 at 21:10:39 UTC, Cecil Ward wrote:
I’ve written my first non-trivial module in D. See other 
thread. 
https://forum.dlang.org/thread/pfjpqcywxrmxwsncy...@forum.dlang.org


I’d like to set up something to call it from other modules, and 
specifically I’d like to see if inlining works across module 
boundaries - I have no idea whether it does or not as I don’t 
understand fully in detail how module imports work.


How do I go about setting up such a test harness with LDC (or 
GDC) on either OSX/ARM or Linux Debian x86-64? I’m not sure 
what tools I need.


Note that I cannot use DMD, this code is LDC/GDC-specific. LDC 
would be my preference as that is what it is ultimately aimed 
at.


Do I just provide two filenames as inputs to the compiler ? I’m 
wondering if the compiler resolves the import statements rather 
than the linker - is that right? I only have a vague 
understanding of how the import statement works - pulling in 
digested intermediate-code or something?


Will in-line functions be inlined even if the called routine is 
across a module boundary?


First module

2023-07-06 Thread Cecil Ward via Digitalmars-d-learn
I’ve written my first non-trivial module in D. See other thread. 
https://forum.dlang.org/thread/pfjpqcywxrmxwsncy...@forum.dlang.org


I’d like to set up something to call it from other modules, and 
specifically I’d like to see if inlining works across module 
boundaries - I have no idea whether it does or not as I don’t 
understand fully in detail how module imports work.


How do I go about setting up such a test harness with LDC (or 
GDC) on either OSX/ARM or Linux Debian x86-64? I’m not sure what 
tools I need.


Note that I cannot use DMD, this code is LDC/GDC-specific. LDC 
would be my preference as that is what it is ultimately aimed at.