Calling functions from other files/modules

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 6 14:15:43 PST 2016


On Wednesday, 6 January 2016 at 22:06:32 UTC, Namal wrote:
> Do I have always to include std.stdio in every file like in the 
> example or is it enough just to import a module which has this 
> already included?

In every file that you use it, yes. Module imports are private to 
the module (well, unless you specifically mark them as public) 
which is different than C includes.

> Why do I need to define my main as the main module? I can't 
> imagine that I can import it somewhere else.

You can import it as long as you define it!

> Is there something like #pragma once that needs to be done?

no need


More information about the Digitalmars-d-learn mailing list