Jump to content
Excelsior Forums
Sign in to follow this  

bitfiedls representation in definelayout()?

Recommended Posts

How can I represent bitfield from the native structure in the definelayout()? e.g.

C code :

typedef {

  unsigned i:10;

  unsigned j:2;

} my_struct;



public MYSTRUCT extends Structure {

     int i;

     int j;

     public String defineLayout() {

           return "unsigned i:10, unsigned j:2";


     public MYSTRUCT() {}


This gives a runtime error

Exception in thread "main" com.excelsior.xFunction.IllegalSignatureException: Ca

n't parse signature record in 'JAVA_OTHER' class.

'unsigned i:10, unsigned j:2'


',' or EOL char expected

       at com.excelsior.xFunction.xFunction.parseSignature(xFunction.java:209)

       at com.excelsior.xFunction.xFunction.<init>(xFunction.java:30)

       at sample9.main(sample9.java:B)

Any help is appreciated.


Share this post

Link to post
Share on other sites

xFunction does not support bitfields.

They could be emulated with whole fields.

For example, you can define your typedef as a structure with one unsigned filed and use bit manipulation to extract/set bit fields.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this