www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Compiling a .d file both as library and executable

reply Shriramana Sharma <samjnaa_dont_spam_me gmail.com> writes:
In Python there is:

if __name__ == "__main__":

to allow the same source file to be treated as both an importable library 
and as an executable script. In D is there any such mechanism to make a 
main() compiled selectively, i.e. by some compile-time flag or such?

-- 
Shriramana Sharma, Penguin #395953
Oct 17 2015
parent anonymous <anonymous example.com> writes:
On Saturday, October 17, 2015 05:36 PM, Shriramana Sharma wrote:

 In Python there is:
 
 if __name__ == "__main__":
 
 to allow the same source file to be treated as both an importable library
 and as an executable script. In D is there any such mechanism to make a
 main() compiled selectively, i.e. by some compile-time flag or such?
 
http://stackoverflow.com/questions/18537761/hyrbid-modul-and-program-behaviour-for-a-d-source-file
Oct 17 2015