www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Importing module from the perspective of submodule.

reply BoQsc <vaidas.boqsc gmail.com> writes:
Is it possible to import module that is not in the module's 
current directory's folder or subfolders?

For example:

I want to import `somemodule2.d` and `somemodule3.d` into a 
**`somemodule.d`**

**.\somefolder\somemodule.d**
.\somemodule2.d
.\someotherfolder\somemodule3.d
Jul 02 2022
parent Paul Backus <snarwin gmail.com> writes:
On Sunday, 3 July 2022 at 05:40:30 UTC, BoQsc wrote:
 Is it possible to import module that is not in the module's 
 current directory's folder or subfolders?

 For example:

 I want to import `somemodule2.d` and `somemodule3.d` into a 
 **`somemodule.d`**

 **.\somefolder\somemodule.d**
 .\somemodule2.d
 .\someotherfolder\somemodule3.d
Yes. You just have to pass the folders with the modules in them to the compiler with the `-I` flag, or (if you're using dub) add the folders to your `importPaths`. ``` dmd -Isomeotherfolder -c somefolder\somemodule.d ```
Jul 02 2022