Windows VS 2013 plugin Property Setter - logical error

Hello,

After working with the free version of Visual Studio 2013, the following code was not able to set the RadVal (a value of a radius of a circle) and the value of 4.163313e-316 is returned. When the code (RadiusVal = RadVal) is replaced with the code (RadiusVal = 45.664) then the correct value (45.664) is returned. Constants and methods work fine in Visual Studio 2013 and I must be missing something simple.

After working on this for a week, how do I get the RadiusSetter to receive a value from Xojo? Here is my code.

Thanks in advance.

[code]#include “WinHeader++.h”
#include “rb_plugin.h”

static void RadiusSetter(DOUBLE RadVal);
static DOUBLE RadiusGetter(void);

REALproperty MyClassProp[] = {
{ “”, “RadValue”, “double”, REALconsoleSafe, (REALproc)RadiusGetter, (REALproc)RadiusSetter },
};

REALclassDefinition MyPropDefinition = {
kCurrentREALControlVersion, //Version
“MyProp”, //Class Name
nil, // Name of the Super if it exists
0, // size of data
0, // This is always 0, as it is reserved
nil, // define default values
nil, // Unlock references to prevent leaks
MyClassProp, // Properties
sizeof(MyClassProp)/sizeof(REALproperty), // Property count
nil, //Methods
0, //Method count
nil, // Events
0, // Event count
nil, // Event instances
0, // Event instance count
nil, // Interfaces
nil, // Binding
0, // Binding count
nil, // Constants
0, // Constant count
0, // Helper methods for flags
nil, // Shared properties
0, // Shared properties count
nil, // Shared methods
0, // Shared method count
};

static double RadiusVal;
static double RadiusGetter(void){
return RadiusVal;
}
static void RadiusSetter(DOUBLE RadVal){
RadiusVal = RadVal;
//RadiusVal = 45.664;
}

void PluginEntry(void){
// Set Flags to console safe
SetClassConsoleSafe(&MyPropDefinition);

// Register the class methods
REALRegisterClass(&MyPropDefinition);

}[/code]

Xojo Code:

Dim t as new MyProp t.RadValue =45.664 MsgBox Cstr(t.RadValue)

2 pure guesses to give you something to play with:

is it a byref / byval situation where you are getting a representation of a pointer?
Does the storage size of a double differ between Xojo and this RealStudio compile?

static void RadiusSetter(DOUBLE RadVal);
static DOUBLE RadiusGetter(void);

this needs to be

static void RadiusSetter(REALobject instance, long param, DOUBLE RadVal);
static DOUBLE RadiusGetter(REALobject instance, long param);

so you have param and instance parameters

Thank you Christian and Jeff for your kind help.

Adding instance and param parameters works great!