Oh, I completely forgot to add support for those compiler options in the property pages, sorry about that, will do it ASAP. Thanks for your reports, indeed this feature has been tested very little, will log all the issues so they will be taken care of.
Remove the ":=" from your #define and it should work as expected. Remember, #define is a preprocessor directive (so no :=), while a DEFINE is "executable" code, so you do need the := with them.
About an untyped Start(), I think it's a requirement of the framework that the Start/Main function (the entry point) has one of few specific signatures, so we cannot allow everything. But Robert may correct me if i am wrong.
I have looked at this and found the problem with the File Wide PUBLICs: they were parsed incorrectly as GLOBALs and not as PUBLICs. That is why they were initialized with NIL in stead of FALSE. (PUBLIC in X# is also an alias for EXPORT, and this caused the confusion). I have fixed that now.
Since there is no "Context" in which they can be initialized they will now be initialized in the same code where Init procedures are called at startup of the app. The file wide PUBLICs are now initialized after all INIT3 procedures have been called.
XSharp Development Team
In the meantime i´ve found a "workaround" to create PUBLICs
FUNCTION Start() AS VOID
? "Content of the Public gc4" , gc4
// PUBLIC gc4
__MemVarDecl("gc4" , FALSE )
? "content of gc4: " , gc4 // ok, shows FALSE
gc4 := "I´m a public"
and none of them are documented in VO, so i´m sure the intention is not to use these funcs directly. In VO they are only used if a command like "SAVE ..." is included, that the preprocessor translates to "_MSave ( .... ). Of course almost none of the VOers use PRIVATES and PUBLICs anymore, but they are essential for e.g. Foxpro users.
? x && Foxpro error "var 'x' not found" is thrown
While the VO/X# RELEASE doesn´t delete a var, the Foxpro RELEASE does. In the X# runtime there´s already the method memVar:ClearAll(), but what´s IMO missing is something like MemVar:Clear ( <cVar>), so the Foxpro RELEASE could be mapped to memVar:Clear ( "x" ).
This shows exactly how tricky it can be to support more than one dialect.
The current implementation of RELEASE does what the VO docs say.
"This command does not actually delete the specified variables from memory like CLEAR ALL or CLEAR MEMORY. Instead, it releases the value of the variables by assigning NIL to them. For this reason, variables that are hidden do not become visible until termination of the routine initiating the RELEASE operation."
To solve this problem I see 2 solutions:
1) have a different header file for VO and FOX or different implementations in the same header file (using conditional compilation) that map the RELEASE command to different function calls
2) Detect the active dialect at runtime and change the behavior of the _MRelease() function depending on the active dialect.
When choosing 1) we could also introduce a new command (or a new clause ) for VO to allow also code in the VO Dialect to completely remove the variables.
XSharp Development Team