Is it possible to disallow import for certain functions?

BoQsc vaidas.boqsc at gmail.com
Sat Jul 27 12:48:12 UTC 2019


On Saturday, 27 July 2019 at 12:06:11 UTC, Mike Parker wrote:
> On Saturday, 27 July 2019 at 12:05:27 UTC, Mike Parker wrote:
>
>>
>> module otherFile;
>>
>> version otherMain() {
>> ...
>> }
>
> eh...
>
> version(otherMain) {
>
> }

I seem to be doing something wrong, the result is the same.
> otherFile.d(8): Error: only one main, WinMain, or DllMain 
> allowed. Previously found main at mainFile.d(11)


mainFile.d
>module mainFile;
>
>
>import otherFile;
>
>import std.stdio : writeln;
>
>
>private version = defaultMain;
>version(defaultMain) {
>	void main(){
>		writeln("test");
>	}
>}

otherFile.d
>module otherFile;
>
>
>
>
>import std.stdio : writeln;
>
>
>private version = otherMain;
>version(otherMain) {
>	void main(){
>		writeln("Interesting");
>	}
>}


More information about the Digitalmars-d-learn mailing list