Is it possible to execute a function inside .d script that has no main function?

BoQsc vaidas.boqsc at gmail.com
Thu Jul 11 09:43:55 UTC 2019


Here I have a file named: module.d

>import std.stdio   : writeln;
>
>void interestingFunction(){
>	writeln("Testing");
>}

There is no main() function since, I want to import this module, 
into another .d file.

( If I try to import and module.d does have main() function I get 
this error: )
> otherFile.d(13): Error: only one main, WinMain, or DllMain 
> allowed. Previously found main at module.d(3)





I would like to launch function "interestingFunction()" directly 
using rdmd.
Is it possible to achieve that by any way?





I tried to launch the whole file, but it gave me some weird 
output:
>C:\Users\User\Desktop\Environment variables>rdmd module.d
>OPTLINK (R) for Win32  Release 8.00.17
>Copyright (C) Digital Mars 1989-2013  All rights reserved.
>http://www.digitalmars.com/ctg/optlink.html
>OPTLINK : Warning 134: No Start Address


More information about the Digitalmars-d-learn mailing list