Skip to content

Memory field not handled in Structure #129

@rnikander

Description

@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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions