module NWRFCLib

Library wrapper around NW RFC SDK shared library using RUBY-FFI

Constants

B_SIZE
Multiplier for providing correct byte size for String passed to RFC library

@todo Make platform-dependent size based on RUBY_PLATFORM

Cutf16le_to_utf8
Cutf8_to_utf16le
RFC_DIRECTION
RFC_ERROR_GROUP
RFC_RC
RFC_TYPE

Public Class Methods

make_conn_params(params) click to toggle source

Take Hash of connection parameters and returns FFI pointer to an array for passing to connection


TODO - Ideally, this method should live in nwrfc.rb

# File lib/nwrfc/nwrfclib.rb, line 457
def NWRFCLib.make_conn_params(params) #https://github.com/ffi/ffi/wiki/Structs
  par = FFI::MemoryPointer.new(RFCConnParam, params.length)
  pars = params.length.times.collect do |i|
    RFCConnParam.new(par + i * RFCConnParam.size)
  end
  #TODO Optimize this method
  tpar = params.to_a
  params.length.times do |n|
    #      str = (tpar[n][0].to_s + "\0").encode("UTF-16LE")
    pars[n][:name] = FFI::MemoryPointer.from_string(tpar[n][0].to_s.cU)
    #      str = (tpar[n][1].to_s + "\0").encode("UTF-16LE")
    #      str = str.encode("UTF-16LE")
    pars[n][:value] = FFI::MemoryPointer.from_string(tpar[n][1].to_s.cU)
  end
  par
end