code:             public int callback(int num_msg, Pointer msg, Pointer resp, Pointer _) {
                  LOGGER.fine("pam_conv num_msg="+num_msg);
                  if(password==null)
                      return PAM_CONV_ERR;
  
                  // allocates pam_response[num_msg]. the caller will free this
                  Pointer m = libc.calloc(pam_response.SIZE,num_msg);
                  resp.setPointer(0,m);
  
                  for( int i=0; i<num_msg; i++ ) {
                      pam_message pm = new pam_message(msg.getPointer(POINTER_SIZE*i));
                      LOGGER.fine(pm.msg_style+":"+pm.msg);
                      if(pm.msg_style==PAM_PROMPT_ECHO_OFF) {
                          pam_response r = new pam_response(m.share(pam_response.SIZE*i));
                          r.setResp(password);
                          r.write(); // write to (*resp)[i]
                      }
                  }
  
                  return PAM_SUCCESS;
              }
          });
  
  