public int callback(S_CODELINE_INFO codelineInfo)
    String codeline=new String(codelineInfo.CodelineRead);
    System.out.println("Codeline document : "+codeline); // Reading from DLL is ok

    // Set field Sorter (JAVA --> DLL)
    codelineInfo.writeField("Sorter", 9); // Writing is KO. The sorted field (sort type) is always equal to 0

    }catch(Exception exp)


    return 0;


public class S_CODELINE_INFO extends Structure
   /************** Parameters compiled from LS500.dll ************************/

    // Size of the struct
    public short Size;  

    // Progessive document number
    public NativeLong NrDoc;

    // Codeline returned    
    public byte[] CodelineRead=new byte[39];    

    // Length of the codeline
    public short NrBytes;   

    // Reserved for future use
    public NativeLong Reserved;                     

    /****************** Parameters compiled from Application *********************/

    // Sorter where put the document
    public short Sorter;    

    // Set from application NORMAL or BOLD
    public byte FormatString;       

    // String to print rear of the document
    public String StringToPrint;

    public S_CODELINE_INFO()

    protected List<String> getFieldOrder() 
        return Arrays.asList(new String[]{
            "Size", "NrDoc", "CodelineRead", "NrBytes", "Reserved", "Sorter","FormatString", "StringToPrint"        

    public static class ByReference extends S_CODELINE_INFO implements Structure.ByReference{};