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

Unable to pass an array of structures using JNAerator and BridJ #319

Closed
davidizatt opened this issue Jun 18, 2012 · 1 comment
Closed

Unable to pass an array of structures using JNAerator and BridJ #319

davidizatt opened this issue Jun 18, 2012 · 1 comment
Labels

Comments

@davidizatt
Copy link

I am having some difficulty using an array of structures.
The C structure looks like this:

typedef struct {
char part1[100];
char part2[100];
char part3[100];
} stuff;

typedef struct {
char part1[100];
char part2[100];
char part3[100];
} something;

typedef struct {
char type[100];
char date[100];
char time[100];
stuff stuff;
something something;
} container;

typedef struct {
char text[512];
container container[1];
} message;

The Java looks like:
message info = new message();
info.text().setCString(“TEST”);
Pointer Pinfo = Pointer.pointerTo(info);

This structure is then passed to a function via the pointer type.

The container array seems to be the problem as the rest of the code was working fine before it’s addition. Is there something I need to do on the java side to initialize the array?

Thanks for any insight you can give.

@ochafik
Copy link
Member

ochafik commented Jun 18, 2012

Hi David,

Thanks for your report !

I've deployed a fix for BridJ's struct layout code that should solve your particular case (if not, please let me know :-)), available in the latest 0.6.2-SNAPSHOT (see https://code.google.com/p/bridj/wiki/Download ).

Cheers

@ochafik ochafik closed this as completed Jun 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants