Global variables in Iodine (not working?)

Hello,

(using Elements v.10.0.0.2461)

trying to declare and use some global variables for the purpose of generating a native DLL from the Java code. Here’s my code, which gives the error messages:

package TestClassLibrary;

public class DriverClass
{

public boolean initialized = false;

boolean initialize()
{
    initialized = true;
}

boolean isInitialized()
{
    return initialized;
}

}

private int SomeX = 1;

private DriverClass driver;

public int InitializeDriver()
{
driver = new DriverClass();
return driver.initialize() ? 0 : -1;
}

public void DriverProc()
{
// do nothing
}

Getting the compiler error “opening parenthesis or less expected, got assign” on the line “private int SomeX = 1;”. Commenting out this line gives the same error on the “DriverClass driver” declaration.

I tried several modifications of those lines (like not initializing the variable, changing its type etc) - this doesn’t make anything.

Hm, that indeed seems like a bug, looks like globe fields are not supported (or something is broken with regards to the support for them). I’ll log an issue. As a temp workaround, you could try moving them to a separate C# or Oxygene source file…

Thanks, logged as bugs://83727

Thank you, so far I am playing with the stuff. I don’t think we’ll use them in practice.

1 Like

Official Java doesn’t support it. And we kind of never added them to our Java support. I’ll look into adding support for this.

1 Like

bugs://83727 got closed with status fixed.