JNA and ZBar(library for bar code reader)

Posted by user219120 on Stack Overflow See other posts from Stack Overflow or by user219120
Published on 2010-03-07T05:43:44Z Indexed on 2010/03/27 14:53 UTC
Read the original article Hit count: 528

Filed under:
|

I'm creating Java Interface with JNA for ZBar(library for bar code reader).

In JNA, structures in C are needed to declare. For example::

// In C
typedef struct {
    char* id;
    char* name;
    int age;
    char* sectionId
} EMPLOYEE;

to

// In Java with JNA
public static class Employee extends Structure {  // com.sun.jna.Structure
    String id;
    String name;
    int age;
    String sectionId;
}

But in ZBar, structures have no members. For example::

// zbar-0.10/include/zbar.h
// line:1009-1011
struct zbar_image_scanner_s;
/** opaque image scanner object. */
typedef struct zbar_image_scanner_s zbar_image_scanner_t;

That doesn't declare size or members of the structures.

How can I write interfaces for these structures in JNA?

© Stack Overflow or respective owner

Related posts about java

Related posts about jna