Closed SamuraiCrow closed 1 year ago
fixed in latest commit. the issue was with the #else parsing
I can send you an updated exe or you can build it yourself from the source.
also your code has a couple of syntax issues.. here is the corrected version
-> Globals are prefixed with g_ and defined here
DEF g_idcmp, g_scrn, g_wndw
#ifdef DEBUG
DEF g_log
PROC trace(msg,var=NIL)
IF var
VfPrintf(g_log,msg,var)
ELSE
Fputs(g_log,msg)
ENDIF
Flush(g_log)
ENDPROC
#else
PROC trace(msg,var=NIL) IS 0
#endif
PROC main()
#ifdef DEBUG
g_log:=Open('file.log',NEWFILE)
#endif
trace('hello log!\n')
#ifdef DEBUG
Close(g_log)
#endif
ENDPROC
I created a workaround in my actual source that put the #ifdef DEBUG
inside the body of the trace() function and #endif
just before the ENDPROC
so the #else
was no longer needed. If it works with your modified snippet above, I trust you fixed it just fine. Thanks for the tip on the MODE_NEWFILE
flag being wrong, I was using C based autodocs.
MODE_NEWFILE is fine if you include the relevant dos module but e-vo also has NEWFILE constant defined by default. So either is fine but it seemed sensible to use the built in one in this case which saves the need to add the extra module which wouldn't even be needed when debug isn't set.
I tried to implement file logging with the following:
When compiled with DEBUG not defined, the compiler complains about the preprocessor directive being in the Global scope.