Compile-time list of imported modules

2024-04-09 Thread Vladimir Marchevsky via Digitalmars-d-learn
core framework mixin once to generate all the boilerplate. And here come troubles. `getSymbolsByUDA` is not recursive and works for single module only. At the same time it seems there is no way to list all imported modules to get symbols from them. So we are back to boilerplate - just li

Re: How to get all modules in a package at CT?

2023-10-05 Thread evilrat via Digitalmars-d-learn
On Thursday, 5 October 2023 at 22:32:36 UTC, mw wrote: So ModuleInfo contains all the modules (transitive closure) built into the current binary that is running? Is there document about this ModuleInfo? I only find Struct object.ModuleInfo https://dlang.org/library/object/module_info.html

Re: How to get all modules in a package at CT?

2023-10-05 Thread mw via Digitalmars-d-learn
ModuleInfo at some point. So ModuleInfo contains all the modules (transitive closure) built into the current binary that is running? Is there document about this ModuleInfo? I only find Struct object.ModuleInfo https://dlang.org/library/object/module_info.html Which seems different.

Re: How to get all modules in a package at CT?

2023-10-05 Thread cc via Digitalmars-d-learn
would need. Otherwise you'd need a new traits for that... but that traits would violate the rule explained before. If you want to iterate the package for modules imported in it, I'm not sure. __traits(allMembers, package) will list names of imported packages but not which modules

Re: How to get all modules in a package at CT?

2023-10-05 Thread user1234 via Digitalmars-d-learn
would need. Otherwise you'd need a new traits for that... but that traits would violate the rule explained before. If you want to iterate the package for modules imported in it, I'm not sure. __traits(allMembers, package) will list names of imported packages but not which modules

Re: How to get all modules in a package at CT?

2023-10-05 Thread mw via Digitalmars-d-learn
that... but that traits would violate the rule explained before. If you want to iterate the package for modules imported in it, I'm not sure. __traits(allMembers, package) will list names of imported packages but not which modules. static reflection on import decls is broken, that wont

Re: How to get all modules in a package at CT?

2023-10-05 Thread user1234 via Digitalmars-d-learn
On Thursday, 5 October 2023 at 18:40:36 UTC, mw wrote: On Saturday, 24 November 2018 at 15:21:57 UTC, Anonymouse wrote: On Saturday, 24 November 2018 at 08:44:19 UTC, Domain wrote: I have a package named command, and many modules inside it, such as command.build, command.pack, command.help

Re: How to get all modules in a package at CT?

2023-10-05 Thread mw via Digitalmars-d-learn
On Saturday, 24 November 2018 at 15:21:57 UTC, Anonymouse wrote: On Saturday, 24 November 2018 at 08:44:19 UTC, Domain wrote: I have a package named command, and many modules inside it, such as command.build, command.pack, command.help... I want to get all these modules at compile time so that

Re: (Noob question) Should subclasses be defined in separate modules?

2023-01-12 Thread Mike Parker via Digitalmars-d-learn
ObjDerived` inside another module, since `ObjDerived` can still access the members of `Obj` (since `private` is only applied to modules), or does this go against the intended use of the language? As a beginner, I am having an extremely tough time understanding why you would want to place these t

(Noob question) Should subclasses be defined in separate modules?

2023-01-12 Thread thebluepandabear via Digitalmars-d-learn
access the members of `Obj` (since `private` is only applied to modules), or does this go against the intended use of the language? As a beginner, I am having an extremely tough time understanding why you would want to place these two classes in the same module or even have this intended behavior o

Re: Importing modules under DUB on Windows

2022-10-28 Thread DLearner via Digitalmars-d-learn
On Friday, 28 October 2022 at 21:32:46 UTC, rikki cattermole wrote: On 29/10/2022 4:15 AM, DLearner wrote: However, going forward, I don't want copies of OM anywhere other than UD. If you want your own private library on your system (that will get used a lot), you can create a package and use

Re: Importing modules under DUB on Windows

2022-10-28 Thread rikki cattermole via Digitalmars-d-learn
On 29/10/2022 4:15 AM, DLearner wrote: However, going forward, I don't want copies of OM anywhere other than UD. If you want your own private library on your system (that will get used a lot), you can create a package and use ``$ dub add-local .`` to add it to the available packages for looku

Re: Importing modules under DUB on Windows

2022-10-28 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 28 October 2022 at 15:15:04 UTC, DLearner wrote: Took suggestion, dub run then produced: `Linking... lld-link: error: subsystem must be defined Error: linker exited with status 1` That means the linker didn't see a `main` function. Make sure you have a `void main() {}` somewhere (an

Re: Importing modules under DUB on Windows

2022-10-28 Thread DLearner via Digitalmars-d-learn
list. Hi To avoid confusion: I wanted to use (yours I think!) arsd-official:terminal, and a (near-trivial) function (call it NTF) held inside one of my own modules (call it OM), itself inside my utilities directory (call it UD). ` "dependencies": { &qu

Re: Importing modules under DUB on Windows

2022-10-28 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 26 October 2022 at 16:20:01 UTC, DLearner wrote: Wanted to use a function stored in a module outside the main source. easiest thing to do with dub is to add it as a sourcePath or a sourceFile. Well, actually, easiest is to just copy the module right into your default src folder,

Re: Importing modules under DUB on Windows

2022-10-27 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 27 October 2022 at 16:40:20 UTC, DLearner wrote: I'm not getting on with DUB. Maybe fewer people use it under Windows, so Windows constructs don't get exercised so much. Is there a non-DUB way of arranging that `import arsd.terminal;` will use that module as held on GitHub? (DUB

Re: Importing modules under DUB on Windows

2022-10-27 Thread rikki cattermole via Digitalmars-d-learn
On 28/10/2022 5:40 AM, DLearner wrote: Maybe fewer people use it under Windows, so Windows constructs don't get exercised so much. I have actively contributed to dub specifically for Windows in the last year :) There is enough of us. Also UNC paths (those with drives and then the slash) are

Re: Importing modules under DUB on Windows

2022-10-27 Thread DLearner via Digitalmars-d-learn
On Thursday, 27 October 2022 at 00:35:26 UTC, Hipreme wrote: On Wednesday, 26 October 2022 at 22:51:53 UTC, DLearner wrote: On Wednesday, 26 October 2022 at 18:53:58 UTC, Hipreme wrote: On Wednesday, 26 October 2022 at 18:37:00 UTC, DLearner wrote: [...] The linker failed to resolve because

Re: Importing modules under DUB on Windows

2022-10-26 Thread Hipreme via Digitalmars-d-learn
On Wednesday, 26 October 2022 at 22:51:53 UTC, DLearner wrote: On Wednesday, 26 October 2022 at 18:53:58 UTC, Hipreme wrote: On Wednesday, 26 October 2022 at 18:37:00 UTC, DLearner wrote: On Wednesday, 26 October 2022 at 16:58:08 UTC, H. S. Teoh wrote: On Wed, Oct 26, 2022 at 04:20:01PM +,

Re: Importing modules under DUB on Windows

2022-10-26 Thread DLearner via Digitalmars-d-learn
On Wednesday, 26 October 2022 at 18:53:58 UTC, Hipreme wrote: On Wednesday, 26 October 2022 at 18:37:00 UTC, DLearner wrote: On Wednesday, 26 October 2022 at 16:58:08 UTC, H. S. Teoh wrote: On Wed, Oct 26, 2022 at 04:20:01PM +, DLearner via Digitalmars-d-learn wrote: [...] Maybe try inst

Re: Importing modules under DUB on Windows

2022-10-26 Thread Hipreme via Digitalmars-d-learn
On Wednesday, 26 October 2022 at 18:37:00 UTC, DLearner wrote: On Wednesday, 26 October 2022 at 16:58:08 UTC, H. S. Teoh wrote: On Wed, Oct 26, 2022 at 04:20:01PM +, DLearner via Digitalmars-d-learn wrote: Hi Never used DUB before. Wanted to use a function stored in a module outside the ma

Re: Importing modules under DUB on Windows

2022-10-26 Thread DLearner via Digitalmars-d-learn
On Wednesday, 26 October 2022 at 16:58:08 UTC, H. S. Teoh wrote: On Wed, Oct 26, 2022 at 04:20:01PM +, DLearner via Digitalmars-d-learn wrote: Hi Never used DUB before. Wanted to use a function stored in a module outside the main source. Main source has `import ;` Put a line into the JS

Re: Importing modules under DUB on Windows

2022-10-26 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Oct 26, 2022 at 04:20:01PM +, DLearner via Digitalmars-d-learn wrote: > Hi > > Never used DUB before. > Wanted to use a function stored in a module outside the main source. > > Main source has `import ;` > > Put a line into the JSON: `"importPaths": "C:\\Users\\..."` pointing > to t

Re: How to find all modules in a package?

2022-08-04 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Aug 04, 2022 at 07:22:04AM +, Domain via Digitalmars-d-learn wrote: > On Wednesday, 3 August 2022 at 12:27:32 UTC, frame wrote: > > On Wednesday, 3 August 2022 at 03:36:55 UTC, Domain wrote: > > > I want to find out all public functions in all modules in a package. &

Re: How to find all modules in a package?

2022-08-04 Thread Domain via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 12:27:32 UTC, frame wrote: On Wednesday, 3 August 2022 at 03:36:55 UTC, Domain wrote: I want to find out all public functions in all modules in a package. Can I do that at compile time? You can do something like that: ```d static foreach (sym; __traits

Re: How to find all modules in a package?

2022-08-03 Thread frame via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 03:36:55 UTC, Domain wrote: I want to find out all public functions in all modules in a package. Can I do that at compile time? You can do something like that: ```d static foreach (sym; __traits(allMembers, mixin("std.string"))) { pragma(msg, sy

Re: How to find all modules in a package?

2022-08-03 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 03:36:55 UTC, Domain wrote: I want to find out all public functions in all modules in a package. Can I do that at compile time? No, D packages are not closed; anyone can add new modules to them at any time.

Re: How to find all modules in a package?

2022-08-03 Thread Piotr Mitana via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 03:36:55 UTC, Domain wrote: I want to find out all public functions in all modules in a package. Can I do that at compile time? I think it's not possible.

How to find all modules in a package?

2022-08-02 Thread Domain via Digitalmars-d-learn
I want to find out all public functions in all modules in a package. Can I do that at compile time?

Re: Can I create a package with friendly modules

2022-06-16 Thread Salih Dincer via Digitalmars-d-learn
/parent/thing/first.d`: ```d module thing.first; import second; static this() { a = second.g; // can also access symbols within neighbouring modules } package(parent): int a; int b; string c; ``` `src/parent/thing/second.d`: ```d module thing.second; package(parent): int g; char p; double dbl

Re: Can I create a package with friendly modules

2022-06-12 Thread Tejas via Digitalmars-d-learn
On Sunday, 12 June 2022 at 05:05:46 UTC, forkit wrote: Is it possible to create a package.d, consisting of (for example), two modules, where each module can access private declarations within each other. In essence, declaring 'a module level friendship', or a kind of 'extended

Re: Can I create a package with friendly modules

2022-06-12 Thread Mike Parker via Digitalmars-d-learn
encapsulating this and that in different physical files, while *still* protecting the 'private is private to the module' concept. You can't spread modules across multiple files. But if D has a one-to-one mapping between a module and a file, and if private is always private t

Re: Can I create a package with friendly modules

2022-06-12 Thread forkit via Digitalmars-d-learn
, the compiler brings the extensions of this module, and treats it as a single module. similar to the concept of bringing in different modules into a package, only more fine-grained. But if D has a one-to-one mapping between a module and a file, and if private is always private to the one module, then this could never work.

Re: Can I create a package with friendly modules

2022-06-12 Thread Salih Dincer via Digitalmars-d-learn
On Sunday, 12 June 2022 at 05:05:46 UTC, forkit wrote: Is it possible to create a package.d, consisting of (for example), two modules, where each module can access private declarations within each other. For this to be possible: You must first collect all modules in the directory with the

Re: Can I create a package with friendly modules

2022-06-11 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 12 June 2022 at 05:05:46 UTC, forkit wrote: Is it possible to create a package.d, consisting of (for example), two modules, where each module can access private declarations within each other. In essence, declaring 'a module level friendship', or a kind of 'extended

Re: Can I create a package with friendly modules

2022-06-11 Thread forkit via Digitalmars-d-learn
On Sunday, 12 June 2022 at 05:05:46 UTC, forkit wrote: e.g. If I could something like this: // foo_1.d module foo_1 private int a; // a is private to module foo_1 // foo_2.d module foo_2 private int b; // b is private to module foo_2 // foo.d module foo[dependencies:foo_1, foo_2]; import st

Can I create a package with friendly modules

2022-06-11 Thread forkit via Digitalmars-d-learn
Is it possible to create a package.d, consisting of (for example), two modules, where each module can access private declarations within each other. In essence, declaring 'a module level friendship', or a kind of 'extended module' if you want. I might still want to add a

Re: D modules

2021-11-13 Thread Adam Ruppe via Digitalmars-d-learn
On Saturday, 13 November 2021 at 22:52:55 UTC, pascal111 wrote: When I'm searching for "toUpper" and "toLower" functions that string type uses They are usable though `import std.string;` the docs just don't do a great job showing that. The newest test version of my doc generator does integra

Re: D modules

2021-11-13 Thread Mike Parker via Digitalmars-d-learn
/phobos/std_string.html"; I didn't found functions I'm searching for, but when I pressed ctrl+f and typed function names, I found 'em in another section of the page, but I didn't understand if I have to add something to module name "std.string" or not, and I don'

Re: D modules

2021-11-13 Thread Imperatorn via Digitalmars-d-learn
/phobos/std_string.html"; I didn't found functions I'm searching for, but when I pressed ctrl+f and typed function names, I found 'em in another section of the page, but I didn't understand if I have to add something to module name "std.string" or not, and I don'

D modules

2021-11-13 Thread pascal111 via Digitalmars-d-learn
27;m searching for, but when I pressed ctrl+f and typed function names, I found 'em in another section of the page, but I didn't understand if I have to add something to module name "std.string" or not, and I don't know how modules divided nor its sections way in D. I hop

Re: Modules ... "import" vs. "compilation" ... what is the real process here?

2021-09-28 Thread Steven Schveighoffer via Digitalmars-d-learn
of template arguments) by modules that actually use those templates. Ali, this is great! ...I had been tempted to also ask about how templates figure into this, but realized that including this in my question would be over complicating the question, so it remained unasked. But, now I have

Re: Modules ... "import" vs. "compilation" ... what is the real process here?

2021-09-27 Thread james.p.leblanc via Digitalmars-d-learn
On Tuesday, 28 September 2021 at 05:26:29 UTC, Ali Çehreli wrote: On 9/27/21 10:38 AM, james.p.leblanc wrote: In addition to what Mike Parker said, templates do complicate matters here: Templates are instantiated (i.e. compiled for a specific set of template arguments) by modules that

Re: Modules ... "import" vs. "compilation" ... what is the real process here?

2021-09-27 Thread james.p.leblanc via Digitalmars-d-learn
On Tuesday, 28 September 2021 at 02:05:43 UTC, Mike Parker wrote: On Monday, 27 September 2021 at 17:38:29 UTC, james.p.leblanc mpilations". Does that help? **Yes!...** === ... this helped immensely! This explanation gave me a much better understanding of how the whole process works.

Re: Modules ... "import" vs. "compilation" ... what is the real process here?

2021-09-27 Thread Ali Çehreli via Digitalmars-d-learn
On 9/27/21 10:38 AM, james.p.leblanc wrote: > I have trouble understanding "module imports" vs. "module compilations". In addition to what Mike Parker said, templates do complicate matters here: Templates are instantiated (i.e. compiled for a specific set of templat

Re: Modules ... "import" vs. "compilation" ... what is the real process here?

2021-09-27 Thread Mike Parker via Digitalmars-d-learn
may help to think in terms of importing modules and compiling source files. Given the source files `A.d` and `B.d`, which implement the modules A and B respectively, and given that module A uses symbols from module B, then we can say the following: 1. When the compiler is compiling `A.d`, it must b

Modules ... "import" vs. "compilation" ... what is the real process here?

2021-09-27 Thread james.p.leblanc via Digitalmars-d-learn
Dear D-ers, I have trouble understanding "module imports" vs. "module compilations". For example, in the dlang.org/tour, we have: **"The import statement makes all public functions and types from the given module available."** And from the dlang.org/spec w

Re: modules and mains

2021-08-22 Thread Brian Tiffin via Digitalmars-d-learn
On Sunday, 22 August 2021 at 10:24:13 UTC, Mathias LANG wrote: On Sunday, 22 August 2021 at 03:22:02 UTC, Brian Tiffin wrote: ... IIUC, you want to generate multiple binaries, too ? In which case, I think you need more of a build tool solution than a language solution. Recent-ish versions o

Re: modules and mains

2021-08-22 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 22 August 2021 at 03:22:02 UTC, Brian Tiffin wrote: Is this wrong thinking? I'm ~~working on~~ playing with a first project. Meant to be a suite of tools, each usable from the command line, i.e. with a `main`. Then a manager program that accepts subcommands for dispatch *and othe

Re: modules and mains

2021-08-21 Thread Brian Tiffin via Digitalmars-d-learn
mandFAAyaZi' > collect2: error: ld returned 1 exit status > ``` > > Is it just wrong thinking and *try again, ya noob*? ;-) Never! :) D modules work both like C's .h files and .c files. (Well, more like C++'s .h files because templates don't need .cpp part.) We import for

Re: modules and mains

2021-08-21 Thread Ali Çehreli via Digitalmars-d-learn
> > Is it just wrong thinking and *try again, ya noob*? ;-) Never! :) D modules work both like C's .h files and .c files. (Well, more like C++'s .h files because templates don't need .cpp part.) We import for declarations but we must also include for linking. Again, this

Re: modules and mains

2021-08-21 Thread Brian Tiffin via Digitalmars-d-learn
On Sunday, 22 August 2021 at 03:22:02 UTC, Brian Tiffin wrote: Is this wrong thinking? I'm ~~working on~~ playing with a first project. Meant to be a suite of tools, each usable from the command line, i.e. with a `main`. Then a manager program that accepts subcommands for dispatch *and othe

modules and mains

2021-08-21 Thread Brian Tiffin via Digitalmars-d-learn
Is this wrong thinking? I'm ~~working on~~ playing with a first project. Meant to be a suite of tools, each usable from the command line, i.e. with a `main`. Then a manager program that accepts subcommands for dispatch *and other boss type things*. boss.d wants to import command1.d command

Re: How Add Local modules mymodule.d using DUB?

2021-08-09 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 9 August 2021 at 16:32:13 UTC, Marcone wrote: My main program need import a local module called mymodule.d. How can I add this module using DUB? Thank you. Let’s assume you just created a dub project in `myproject` with `dub init`. Place `mymodule.d` alongside `app.d` in `myproject

Re: How Add Local modules mymodule.d using DUB?

2021-08-09 Thread Marcone via Digitalmars-d-learn
On Monday, 9 August 2021 at 16:37:10 UTC, Steven Schveighoffer wrote: On 8/9/21 12:32 PM, Marcone wrote: My main program need import a local module called mymodule.d. How can I add this module using DUB? Thank you. You mean how to add a local project (that isn't on code.dlang.org)? `dub add

Re: How Add Local modules mymodule.d using DUB?

2021-08-09 Thread Marcone via Digitalmars-d-learn
`dub add-local .` inside the project directory. I don't think you can add a file directly without a project, but possibly. -Steve I want add modules as phobos modules, but custom modules.

Re: How Add Local modules mymodule.d using DUB?

2021-08-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/9/21 12:32 PM, Marcone wrote: My main program need import a local module called mymodule.d. How can I add this module using DUB? Thank you. You mean how to add a local project (that isn't on code.dlang.org)? `dub add-local .` inside the project directory. I don't think you can add a file

How Add Local modules mymodule.d using DUB?

2021-08-09 Thread Marcone via Digitalmars-d-learn
My main program need import a local module called mymodule.d. How can I add this module using DUB? Thank you.

Re: Why DUB do not import local D modules dependencies?

2021-04-09 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 10 April 2021 at 02:10:48 UTC, Marcone wrote: How make dub import local D modules (mymodule.d) dependencies? Dub doesn't import modules. That's for the compiler. Dub will send every module in your source directory tree to the compiler and they will be available to im

Re: Why DUB do not import local D modules dependencies?

2021-04-09 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 10 April 2021 at 02:10:48 UTC, Marcone wrote: How make dub import local D modules (mymodule.d) dependencies? Could you please provide more details about your scenario, otherwise it is quite hard to understand your question. Kind regards Andre

Why DUB do not import local D modules dependencies?

2021-04-09 Thread Marcone via Digitalmars-d-learn
How make dub import local D modules (mymodule.d) dependencies?

Re: unittests and imported modules

2021-01-28 Thread H. S. Teoh via Digitalmars-d-learn
To answer your other question: On Thu, Jan 28, 2021 at 07:44:59PM +, kdevel via Digitalmars-d-learn wrote: [...] > After inserting print statements into the other modules I found that > the additional four unittests originate from the imported files. Is > there a trick to get

Re: unittests and imported modules

2021-01-28 Thread kdevel via Digitalmars-d-learn
, this inaccurate message has been replaced with: 5 modules passed unittests The count displayed is not the number of unittests, but the number of *modules* that passed unittests. I've no idea why the original message was worded in such a misleading way, but it should have been fixed b

Re: unittests and imported modules

2021-01-28 Thread H. S. Teoh via Digitalmars-d-learn
h version of dmd is this? In the latest releases, this inaccurate message has been replaced with: 5 modules passed unittests The count displayed is not the number of unittests, but the number of *modules* that passed unittests. I've no idea why the original message was worded in such a

unittests and imported modules

2021-01-28 Thread kdevel via Digitalmars-d-learn
other modules I found that the additional four unittests originate from the imported files. Is there a trick to get only the unittest from run other than dropping the "-i" and specifiying the other object files on the command line? And why are the unittests from the imported phobos fun

Re: visibility of private Class C in module named "C"; private variables in modules

2020-12-27 Thread kdevel via Digitalmars-d-learn
bugreport filed https://issues.dlang.org/show_bug.cgi?id=21508

Re: visibility of private Class C in module named "C"; private variables in modules

2020-12-26 Thread kdevel via Digitalmars-d-learn
On Saturday, 26 December 2020 at 18:43:19 UTC, kdevel wrote: $ dmd main.d $ dmd -i main

Re: visibility of private Class C in module named "C"; private variables in modules

2020-12-26 Thread kdevel via Digitalmars-d-learn
On Saturday, 26 December 2020 at 17:48:17 UTC, Mike Parker wrote: On Saturday, 26 December 2020 at 15:58:30 UTC, kdevel wrote: package class Private { void foo () { __PRETTY_FUNCTION__.writeln; } } import Private; auto p = new Private; // works, but Private.Private is private ?!?

Re: visibility of private Class C in module named "C"; private variables in modules

2020-12-26 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 26 December 2020 at 15:58:30 UTC, kdevel wrote: package class Private { void foo () { __PRETTY_FUNCTION__.writeln; } } import Private; auto p = new Private; // works, but Private.Private is private ?!? You've declared `Private` as `package`.

visibility of private Class C in module named "C"; private variables in modules

2020-12-26 Thread kdevel via Digitalmars-d-learn
~~~Private.d module Private; class A {} private class B {} package class Private { void foo () { __PRETTY_FUNCTION__.writeln; } } ~~~ ~~~main.d void main () { import Private: A; // okay // import Private: B; // main.d(4): Error: module Private member B // is not

Re: Does dmd's -i "include imported modules in the compilation" switch generate object files?

2020-11-04 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-11-03 20:02, H. S. Teoh wrote: I believe -i behaves as though you manually typed the names of the source files on the command line. So it would do what the compiler would usually do in the latter case. Yes, this is correct. AFAIK, that means it loads everything into memory and produ

Re: Does dmd's -i "include imported modules in the compilation" switch generate object files?

2020-11-03 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Nov 03, 2020 at 10:42:55AM -0800, Ali Çehreli via Digitalmars-d-learn wrote: > -i is a useful feature: > > https://dlang.org/dmd-linux.html > > Does dmd compile auto-included files separately? Does it generate > temporary object files? If so, where does it write the files? Would -i > c

Does dmd's -i "include imported modules in the compilation" switch generate object files?

2020-11-03 Thread Ali Çehreli via Digitalmars-d-learn
-i is a useful feature: https://dlang.org/dmd-linux.html Does dmd compile auto-included files separately? Does it generate temporary object files? If so, where does it write the files? Would -i cause race conditions on the file system? Thank you, Ali

Re: How to import modules from another folder ?

2020-05-13 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 13 May 2020 at 22:10:02 UTC, Vinod K Chandran wrote: Hi all, I am practicing some win32 api coding in D. So far so good. But when i tried to import some d files from another folder, i wonder how do this. This is my folder structure. --> Source Folder --> app.d //This is

How to import modules from another folder ?

2020-05-13 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am practicing some win32 api coding in D. So far so good. But when i tried to import some d files from another folder, i wonder how do this. This is my folder structure. --> Source Folder --> app.d //This is my main file. I am importing guiLib in this main file. -->

Re: How make DMD auto link imported modules?

2020-04-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 21 April 2020 at 21:36:57 UTC, Marcone wrote: When I create a module, for exemple mymodule.d and import im my main program using "import mymodule" I need add mymodule.d in DMD command line manually. How can make it automatic? dmd -i

How make DMD auto link imported modules?

2020-04-21 Thread Marcone via Digitalmars-d-learn
When I create a module, for exemple mymodule.d and import im my main program using "import mymodule" I need add mymodule.d in DMD command line manually. How can make it automatic?

Re: " include imported modules in the compilation " should exclude di file

2020-03-18 Thread Mathias Lang via Digitalmars-d-learn
On Monday, 9 March 2020 at 13:55:08 UTC, Calvin P wrote: The current compiler "-i=module_name" option will include imported modules as source code. When the module define from di file extension, I think compiler should avoid treat it as source file. What do you think? Sound

Re: " include imported modules in the compilation " should exclude di file

2020-03-09 Thread Calvin P via Digitalmars-d-learn
On Monday, 9 March 2020 at 13:55:08 UTC, Calvin P wrote: The current compiler "-i=module_name" option will include imported modules as source code. When the module define from di file extension, I think compiler should avoid treat it as source file. What do you think? The use c

" include imported modules in the compilation " should exclude di file

2020-03-09 Thread Calvin P via Digitalmars-d-learn
The current compiler "-i=module_name" option will include imported modules as source code. When the module define from di file extension, I think compiler should avoid treat it as source file. What do you think?

Re: How to import & export modules

2019-11-10 Thread Mike Parker via Digitalmars-d-learn
odule". https://dlang.org/spec/module.html#package-module Given a package "mylib" containing multiple modules, create a file "mylib/package.d". Use the package name as the module name and follow it with your public imports: module mylib; public import mylib.foo, mylib.bar, m

Re: How to import & export modules

2019-11-10 Thread Arun Chandrasekaran via Digitalmars-d-learn
#public_imports Just a nitpick, prefer to use D style: https://dlang.org/dstyle.html Modules are essentially files. So keeping them lower case makes it easier.

Re: How to import & export modules

2019-11-10 Thread userTY via Digitalmars-d-learn
On Sunday, 10 November 2019 at 23:53:22 UTC, Vinod K Chandran wrote: Hi all, I am practicing D by writting a win API gui wrapper. I want to use a single module import to use this Gui lib. Say i have 10 modules like-- "App.d, Form.d, Button.d, Label.d, TextBox.d, ComboBox.d, List

How to import & export modules

2019-11-10 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am practicing D by writting a win API gui wrapper. I want to use a single module import to use this Gui lib. Say i have 10 modules like-- "App.d, Form.d, Button.d, Label.d, TextBox.d, ComboBox.d, ListBox.d, CheckBox.d, Panel.d, DateTimePicker.d" In Nim, i can import and

Re: do mir modules run in parallell

2019-10-06 Thread David via Digitalmars-d-learn
On Sunday, 6 October 2019 at 05:32:34 UTC, 9il wrote: mir-blas, mir-lapack, and lubeck parallelism depend on system BLAS/LAPACK library (OpenBLAS, Intel MKL, or Accelerate Framework for macos). mir-optim by default single thread but can use TaskPool from D standard library as well as user-def

Re: do mir modules run in parallell

2019-10-05 Thread 9il via Digitalmars-d-learn
On Saturday, 5 October 2019 at 14:51:03 UTC, David wrote: On Saturday, 5 October 2019 at 04:38:34 UTC, 9il wrote: On Friday, 4 October 2019 at 20:32:59 UTC, David wrote: Hi I am wondering if MIR modules run in parallel by default or if I can enforce it by a compiler flag? Thanks David

Re: do mir modules run in parallell

2019-10-05 Thread David via Digitalmars-d-learn
On Saturday, 5 October 2019 at 04:38:34 UTC, 9il wrote: On Friday, 4 October 2019 at 20:32:59 UTC, David wrote: Hi I am wondering if MIR modules run in parallel by default or if I can enforce it by a compiler flag? Thanks David Hey David, Do you mean unittests run in parallel or mir

Re: do mir modules run in parallell

2019-10-04 Thread 9il via Digitalmars-d-learn
On Friday, 4 October 2019 at 20:32:59 UTC, David wrote: Hi I am wondering if MIR modules run in parallel by default or if I can enforce it by a compiler flag? Thanks David Hey David, Do you mean unittests run in parallel or mir algorithms themselves run in parallel? Ilya

do mir modules run in parallell

2019-10-04 Thread David via Digitalmars-d-learn
Hi I am wondering if MIR modules run in parallel by default or if I can enforce it by a compiler flag? Thanks David

How do I install modules into my project?

2019-09-18 Thread Shadowblitz16 via Digitalmars-d-learn
how do I install modules into my project? I have installed dub and tried doing "dub add tkd" and "dub install tkd" to install this library https://github.com/nomad-software/tkd however I get this error when building.. Severity Code Description Project FileLine

Re: When should we use Modules and when Should we use Classes?

2019-09-18 Thread Adam D. Ruppe via Digitalmars-d-learn
or array, you can make temporary ones, replacable ones, etc. Modules cannot do any of that. So in short: * use a module to group classes and functions * use a class when you need to subclass it and customize functionality and/or need several instances * use a struct for most other cases, it is

When should we use Modules and when Should we use Classes?

2019-09-18 Thread BoQsc via Digitalmars-d-learn
Would be nice to have a short summary or detailed answer on this. Some resources to discuss this topic: https://dlang.org/spec/class.html https://dlang.org/spec/module.html

Re: Why are extern(C/C++) definitions and references mangled differently in separately compiled modules?

2019-09-07 Thread Max Samukha via Digitalmars-d-learn
On Saturday, 7 September 2019 at 13:01:38 UTC, Jacob Carlborg wrote: On 2019-09-06 21:03, Max Samukha wrote: Is there any practical use of having identically named .d and .di alongside? Same as in C/C++. This allows you to have a header file if you want to distribute a closed source library.

Re: Why are extern(C/C++) definitions and references mangled differently in separately compiled modules?

2019-09-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-09-06 21:03, Max Samukha wrote: Is there any practical use of having identically named .d and .di alongside? Same as in C/C++. This allows you to have a header file if you want to distribute a closed source library. -- /Jacob Carlborg

Re: Why are extern(C/C++) definitions and references mangled differently in separately compiled modules?

2019-09-06 Thread Max Samukha via Digitalmars-d-learn
On Friday, 6 September 2019 at 17:54:51 UTC, Adam D. Ruppe wrote: On Friday, 6 September 2019 at 17:42:08 UTC, Max Samukha wrote: That file was silently imported by the compiler (probably, a bug). That's by design - the automatic module import lookups actually always look for .di file first,

Re: Why are extern(C/C++) definitions and references mangled differently in separately compiled modules?

2019-09-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 6 September 2019 at 17:42:08 UTC, Max Samukha wrote: That file was silently imported by the compiler (probably, a bug). That's by design - the automatic module import lookups actually always look for .di file first, then .d files.

Re: Why are extern(C/C++) definitions and references mangled differently in separately compiled modules?

2019-09-06 Thread Max Samukha via Digitalmars-d-learn
On Friday, 6 September 2019 at 16:55:31 UTC, Max Samukha wrote: On Friday, 6 September 2019 at 15:52:46 UTC, Stefan Koch wrote: If that is happening you hit a bug. It seems unlikely though. Could you elaborate a bit? How should extern(C/C++) definitions be mangled - fully qualified or not,

Re: Why are extern(C/C++) definitions and references mangled differently in separately compiled modules?

2019-09-06 Thread Max Samukha via Digitalmars-d-learn
On Friday, 6 September 2019 at 15:52:46 UTC, Stefan Koch wrote: On Friday, 6 September 2019 at 15:09:22 UTC, Max Samukha wrote: Consider the following two modules: 1. test.d: module test; import lib.a; void main() { foo(); } 2. lib/a.d: module lib.a; extern(C) void foo() {} When

Re: Why are extern(C/C++) definitions and references mangled differently in separately compiled modules?

2019-09-06 Thread Max Samukha via Digitalmars-d-learn
On Friday, 6 September 2019 at 15:32:07 UTC, 0xEAB wrote: On Friday, 6 September 2019 at 15:09:22 UTC, Max Samukha wrote: Consider the following two modules: What compiler version are you using? DMD64 D Compiler v2.088.0-1-g4011382ea, linux

Re: Why are extern(C/C++) definitions and references mangled differently in separately compiled modules?

2019-09-06 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 6 September 2019 at 15:09:22 UTC, Max Samukha wrote: Consider the following two modules: 1. test.d: module test; import lib.a; void main() { foo(); } 2. lib/a.d: module lib.a; extern(C) void foo() {} When compiled separately (dmd -c lib/a.d; dmd test.d a.o), the

  1   2   3   4   5   >