On 1/25/16 8:40 PM, Igor wrote:
how can I have a static assignment
static bool isStarted = false;
public static Application Start(string Name, void
function(Application) entryPoint)
{
if (isStarted)
assert("Can only call Start once");
isStarted = true;
...
but I don't want this a runtime check.
I'm not sure you even need to worry about this check at all. Just don't
call the function again!
If you don't want other modules to have access, make the function
private in its own module. Then nothing else can call it. Of course, you
have to either name it properly or have the startup code in the same
module (I'm unsure how Windows does this).
But I think if you want the check, it necessarily must be during
runtime. At compile time, the code isn't running, it's just compiling.
-Steve