www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Include http based module

reply tcak <tcak gmail.com> writes:
I have written a test module and put it into /var/www/html:

module mymodule;

import std.stdio;

void testMe(){ writeln("I tested you!"); }


Then I have a main file where I would like to call the function 
"testMe".


My build line is as follows:

dmd main.d "http://localhost/mymodule.d"


Result:

Error: module mymodule is in file 'http://localhost/mymodule.d' 
which cannot be read
import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import


Is there any way to include http(s) based modules into 
compilation (Please do not suggest dub etc)?
Feb 19 2021
next sibling parent Mike Parker <aldacron gmail.com> writes:
On Friday, 19 February 2021 at 19:20:39 UTC, tcak wrote:

 Is there any way to include http(s) based modules into 
 compilation (Please do not suggest dub etc)?
No, the compiler only looks for modules on the filesystem via standard file paths, not via URI. There isn't any tool in the D ecosystem that would enable that.
Feb 19 2021
prev sibling parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Friday, 19 February 2021 at 19:20:39 UTC, tcak wrote:
 I have written a test module and put it into /var/www/html:

 module mymodule;

 import std.stdio;

 void testMe(){ writeln("I tested you!"); }


 Then I have a main file where I would like to call the function 
 "testMe".


 My build line is as follows:

 dmd main.d "http://localhost/mymodule.d"


 Result:

 Error: module mymodule is in file 'http://localhost/mymodule.d' 
 which cannot be read
 import path[0] = /usr/include/dmd/phobos
 import path[1] = /usr/include/dmd/druntime/import


 Is there any way to include http(s) based modules into 
 compilation (Please do not suggest dub etc)?
If you *desperately* wanted that I guess you could map it via some fs-network driver or similar.
Feb 20 2021