Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EEZ Flow: Native arrays give compile errors #260

Open
fietser28 opened this issue May 18, 2023 · 2 comments
Open

EEZ Flow: Native arrays give compile errors #260

fietser28 opened this issue May 18, 2023 · 2 comments

Comments

@fietser28
Copy link
Collaborator

Defining a native array of integers:
image

Check and build are fine, but compilation gives:

image
Something seems of in the generated code.

With an array of strings a similar error appears. Non native arrays work fine.
Compiling on RP2040 / platformio and earlephilhower core.

I also noticed in vars.h the external definition of an array of integers is very generic (void*):
image
Isn't this very prone to errors? You have to keep types manually in sync between code and flow definition and with a void definition the compiler might not catch an error or do a type cast for you? I couldn't test this because of the compile error.

@prasimix prasimix added the bug label May 18, 2023
@prasimix prasimix added this to the M15 milestone May 18, 2023
@mvladic
Copy link
Contributor

mvladic commented May 26, 2023

In the next version of EEZ Studio it will be only possible to have native global variables of these types:

  • Integer
  • Float
  • Double
  • Boolean
  • String
  • Enum of any type

It will not be possible to enable Native checkbox for any other variable type.

So, above error will not be possible.

But, it will be possible to access and modify array and struct flow variables using native code.

For example, Point structure:

image

and points variable defined as array of Point:

image

Example of setting points array from native to flow:

ArrayOfPointValue points(10);

for (unsinged i = 0; i < 10; i++) {
  PointValue point;

  point.x(i);
  point.y(2 * i + 1);

  points.at(i, point);
}

flow::setGlobalVariable(FLOW_GLOBAL_VARIABLE_POINTS, points);

Get points array from flow to native:

ArrayOfPointValue points = flow::getGlobalVariable(FLOW_GLOBAL_VARIABLE_POINTS);

for (unsinged i = 0; i < points.length(); i++) {
  auto x = points.at(i).x();
  auto y = points.at(i).y();
  // ...
}

mvladic added a commit that referenced this issue May 26, 2023
@fietser28
Copy link
Collaborator Author

I think this one can be closed? Or do you want to keep it open until it is described in documentation? (I currently don't see this on the published docs on envox.eu)

@mvladic mvladic modified the milestones: M15, M16 Jun 30, 2023
@mvladic mvladic modified the milestones: M16, M17 Jul 27, 2023
@mvladic mvladic modified the milestones: M17, v1.0 Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants