I am facing a problem while calling a VB DLL (for which I do not have a
source code, just know the function signatures which DLL exposes) from a
DLL Function signature is as follows:
Public Declare Function GetContentsStream Lib
'(arg1 As Byte, _
' ByVal lElements As Long, _
' ByVal sStreamName As String) As Long
Following is the explanation given by DLL author regarding argument
types & how that DLL should be called:
lLen = GetContentsStream(arrayObj(0), UBound(arrayObj), sStreamName)
Parameter1: arrayObj is an array of Bytes. We pass the the first
element of the
array by Reference, arrayObj (0), which really means we are passing the
address of the
start of the array.
Parameter2: Ubound (arrayObj) is the length of the array.
Parameter3: Stream name of type string.
I have written following code to call this dll:
getdllfun = Win32API.new('C:\WINDOWS\system32\SSGetContents.dll',
“GetContentsStream", ['P','L','P'], 'L')
sStreamName = "CONTENTS"
## arrayObj stores some binary bitmap data
puts "\n value: " + val.to_s
When I execute this code, I get following error while executing function
storeLOBData.rb:211: in `fgetContentsStream': uninitialized constant
May be there is a problem with argument types which I am specifying
i.e. ['P','L','P'] & argument which I am passing to DLL.
Any help regarding mapping VB parameter types to Ruby would be really
Thanks and Regards,
Posted via http://www.ruby-forum.com/.