Page 1 of 1

Autoload Modules

Posted: Tue Aug 27, 2013 2:44 am
by jassing
It would be nice to standardize on a file extension (ie: .pbm for purebasic module)
And when you issue UseModule MyModule
if mymodule is not already defined, the compiler looks for a file "MyModule.pbm" and includes it auto-magically, before actually acting on the "useModule" command.

Re: Autoload Modules

Posted: Sun Sep 08, 2013 7:22 am
by Danilo
jassing wrote:It would be nice to standardize on a file extension (ie: .pbm for purebasic module)
And when you issue UseModule MyModule
if mymodule is not already defined, the compiler looks for a file "MyModule.pbm" and includes it auto-magically, before actually acting on the "useModule" command.
Could you compile a macro as resident file, so you can use that feature now?

Code: Select all

Macro DQ
    "
EndMacro

Macro ImportModule(name) ; include and use module
    XIncludeFile #PB_Compiler_Home + "modules/" + DQ#name#DQ + ".pbm"
    UseModule name    
EndMacro

Macro LoadModule(name)   ; include module
    XIncludeFile #PB_Compiler_Home + "modules/" + DQ#name#DQ + ".pbm"
EndMacro

Macro Include(name)      ; include .pbi
    XIncludeFile #PB_Compiler_Home + "includes/" + DQ#name#DQ + ".pbi"
EndMacro


ImportModule(fileModule)

LoadModule(windowModule)

Include(gDrawing)

Re: Autoload Modules

Posted: Sun Sep 08, 2013 11:27 am
by Bisonte
@Danilo: Thanks for this macro. Image