Add array to class properties and add more classes to a module

I have two questions here.

First. How to add an array to class properties? I’ve tried to add

{NULL, "y()", "Double", REALconsoleSafe, REALstandardGetter, REALstandardSetter, FieldOffset(StructTest, y)},

with no luck.

Second. How to add two or more classes to a module? Currently, I can add one class to a module only.

you must highlight the Module (click twice to make highlight color blue), then add a new class

Oh sorry for being not clearly stated in the question that this is related to plugin SDK. BTW, Thanks Axel :).

Really, none know how to achieve this?

The “()” in the property name is not right.

and don’t you normally pass a list of class objects to module registration?

[quote=295325:@Christian Schmitz]The “()” in the property name is not right.
[/quote]
I really don’t have a clue how to do that. This

{NULL, "y", "Double()", REALconsoleSafe, REALstandardGetter, REALstandardSetter, FieldOffset(StructTest, y)},

will produce syntax error, while

{NULL, "y", "Double", REALconsoleSafe, REALstandardGetter, REALstandardSetter, FieldOffset(StructTest, y)},

is a non-array definition. Can you please give me a clue about that?

[quote=295325:@Christian Schmitz]
and don’t you normally pass a list of class objects to module registration?[/quote]
Maybe I’m doing something wrong. I’ve tried this code

REALclassDefinition sc[] = {class1, class2};
REALclassDefinition* tsc = sc;
REALclassDefinition** classDef = &tsc;

REALmoduleDefinition Module1 = {
    ...,
    classDef, sizeof(classDef) / sizeof(classDef[0]),
};

but only first class is shown in the IDE autocomplete. Similar to this code.

REALclassDefinition sc[] = {class1, class2};
REALclassDefinition* tsc = sc;
REALclassDefinition** classDef = &tsc;

REALmoduleDefinition Module1 = {
    ...,
    &tsc, sizeof(*tsc) / sizeof(tsc[0]),
};

and this will produce segmentation fault.

REALclassDefinition sc[] = {class1, class2};
REALclassDefinition* tsc = sc;
REALclassDefinition** classDef = &tsc;

REALmoduleDefinition Module1 = {
    ...,
    &tsc, 2,
};

Shouldn’t it be as in Xojo that the parentheses follows the property name? Like this:

{NULL, "y()", "Double", REALconsoleSafe, ...

[quote=295556:@Eli Ott]Shouldn’t it be as in Xojo that the parentheses follows the property name? Like this:

{NULL, "y()", "Double", REALconsoleSafe, ...

I got error when compiling the code

Again, for over 15 years I make plugins and array properties never worked. Don’t use them!

Asis,

Have you read my thread regarding the same problem? I feel for you brother, I’m having the same issue with my custom classes which contain arrays.

Recently, I downloaded some SDK code which compiles successfully that may address this issue, but I’ve not yet converted it for use in my classes.

Stay tuned!!

Cheers
Grant

How are you adding your one class?

You register multiple classes in your plugin in the PluginEntry method as follows:

[code]void PluginEntry(void){
REALRegisterModule(&MyModule_Definition);
REALRegisterClass(&MyClass1_Definition);
REALRegisterClass(&MyClass2_Definition);
REALRegisterClass(&MyClass3_Definition);
REALRegisterClass(&MyClass4_Definition);

// etc...etc.

};[/code]

Cheers
Grant