Is it possible to disallow import for certain functions?

BoQsc vaidas.boqsc at gmail.com
Sat Jul 27 11:54:09 UTC 2019


I would like to make sure that function in module that I have 
won't be imported, is this possible to achieve?

Test subject:


mainFile.d
> import otherFile;
> void main(){
> 	
> }

otherFile.d
>import std.stdio : writeln;
>import std.file  : mkdir;
>
>int main(){
>	writeln("test ");
>	return 0;
>}


Error, main() method has been imported:
how to disallow main() method from being imported?
> otherFile.d(5): Error: only one main, WinMain, or DllMain 
> allowed. Previously found main at mainFile.d(3)


More information about the Digitalmars-d-learn mailing list