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

Unnamed union processed but incorrectly referenced #106

Open
kevemueller opened this issue Dec 13, 2015 · 0 comments
Open

Unnamed union processed but incorrectly referenced #106

kevemueller opened this issue Dec 13, 2015 · 0 comments

Comments

@kevemueller
Copy link

First of all: amazing work!
I am running jnaerator-0.12 against the capstone library https://capstone-engine.github.io/download/3.0.4/capstone-3.0.4-win64.zip it produces a way better binding than the hand-tooled one of the author.
I ran into a strange show stopper.

typedef struct cs_detail {
  uint8_t regs_read[12];
  uint8_t regs_read_count; 
  uint8_t regs_write[20]; 
  uint8_t regs_write_count; 
  uint8_t groups[8]; 
  uint8_t groups_count; 
  union {
    cs_x86 x86; 
    cs_arm64 arm64;
    cs_arm arm; 
    cs_mips mips;   
    cs_ppc ppc; 
    cs_sparc sparc;
    cs_sysz sysz;   
    cs_xcore xcore;
  };
} cs_detail;

The unnamed union is processed fine, but the field1 accessor is referencing a completely different class than the one which is defined in the inner static class.

public class cs_detail extends StructObject {
  [...]
  public capstone.cs_arm_op.field1_union field1() {
    return this.io.getNativeObjectField(this, 6);
  }
  @Union 
  public static class field1_union extends StructObject {

At runtime the actual union is inaccessible.
Removing the erroneous capstone.cs_arm_op. yields a perfectly valid result.
I appreciate any feedback on how to resolve.

Cheers, and keep up the good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant