# opCallOnceYeNot

Syntax: | Copy
    #ilASM{ jmp :!opCallOnceYeNot
            ...
          }
Description: | Ensures a builtins/VM component has compiled correctly. Suppose you have a file my_include.e (normal, hll) as follows:
    puts(1,"Hi\n")
    global procedure bye()
        puts(1,"Bye\n")
    end procedure
    puts(1,"There\n")
And a little test program:
    include my_include.e
    bye()
Now, obviously you would expect the "Hi" (and "There") to be displayed before the "Bye". Each file generates a hidden top-level subroutine, which the compiler invokes, but only when it needs to. There are hundreds of files in builtins\VM so the last thing we want is to call hundreds of empty top-level subroutines that do nothing, when each and every program starts. I can optimise that away (and have), this is the mechanism I use to stop myself accidentally adding (more of) them. The definition of :!opCallOnceYeNot is simply just an int3 statement, and there is not much point making that a more human-readable error with a source code line number, since jumping to that definition is not actually very helpful, and jumping to the point of cause, especially for an auto-include, wouldn’t be either. An example of something that can trigger this error is adding say
    constant something = somefunc()
to a builtins/VM source file (above the jmp). Of course that sort of thing is fine if really needed, in which case you probably want to replace the jmp :!opCallOnceYeNot with
    #ilASM{ jmp :fin
            ...
            ::fin
          }
However, in most cases [in builtins/VM] it is probably better to defer such initialisation until it is actually needed, and it should be no big deal to make that private constant into a private variable instead, given the only difference between said is the compiler automatically checking for and blocking (accidental) modification, and only for the hll code at compile-time, not at run-time, and besides, freely letting any ilASM{} code run completely amok anyway.
Defined in: | builtins\VM\pUnassigned.e