Memory field not handled in Structure #129

Closed
rnikander opened this Issue Sep 28, 2012 · 0 comments

Projects

None yet

2 participants

@rnikander

Apparently fields of type Memory are not handled. The simple fix is to declare the field with type Pointer.

Example class that causes an error:

public class AudioBuffer extends Structure { 
    public int numberChannels; 
    public int dataByteSize; 
    public Memory data; 
    public AudioBuffer(int sz) { 
        data = new Memory(sz); 
        dataByteSize = sz; 
    } 
} 

Exception in thread "main" java.lang.IllegalArgumentException: Invalid
Structure field in class macaudio.AudioBufferList, field name
'buffers', class [Lmacaudio.AudioBuffer;: Invalid Structure field in
class macaudio.AudioBuffer, field name 'data', class
com.sun.jna.Memory: Type class com.sun.jna.Memory has unknown native
alignment

@twall twall added a commit that closed this issue Oct 5, 2012
@twall twall fixes #129 eaff9bd
@twall twall closed this in eaff9bd Oct 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment