From: V KANETKAR Date: 2004-03-03T12:55:35+09:00 Subject: Accessing DLL from Ruby This is a multi-part message in MIME format. ------=_NextPartTM-000-1542728c-d567-4249-85d7-1025f88d4cfa Content-Type: multipart/alternative; boundary="----=_NextPart_000_0058_01C40103.8627C720" ------=_NextPart_000_0058_01C40103.8627C720 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have a problem: I am trying to call a function from a Visual Basic DLL. I wrote = following code but Ruby gave error. I need to resolve this and need expert Ruby?windows help. #Ruby Program to load dll(Just loading) require 'Win32API' dllcalc=3DWin32API.new("E:\\download\\sudha\\prjCalc.dll","calc",["I"],'I= ') # Error=20 >ruby dmapi.rb dmapi.rb:2:in `initialize': GetProcAddress: calc or calcA (RuntimeError) from dmapi.rb:2:in `new' from dmapi.rb:2 >Exit code: 1 # The Visual Basic Code for the dll. Contains only one function calc. = Returns integer, i/p is one integer # Works OK in VB. The dll was registered in Registry: same error. Public Function calc(intVal1 As Integer) As Integer calc =3D -intVal1 End Function # A similar example given in "Pragmatic Programmer" works finr! # Please Help V V Kanetkar ------=_NextPart_000_0058_01C40103.8627C720 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I have a problem:
I am trying to call a function from a = Visual Basic=20 DLL. I wrote following code but Ruby gave error.
I need to resolve this and need expert = Ruby?windows=20 help.
 

#Ruby Program to load dll(Just loading)
require=20 'Win32API'
dllcalc=3DWin32API.new("E:\\download\\sudha\\prjCalc.dll","= calc",["I"],'I')
 

# Error
 
>ruby dmapi.rb
dmapi.rb:2:in `initialize': GetProcAddress: = calc or=20 calcA (RuntimeError)
 from dmapi.rb:2:in `new'
 from=20 dmapi.rb:2
>Exit code: 1
 
 
 
# The Visual Basic Code for the dll. Contains only one function = calc.=20 Returns integer, i/p is one integer
# Works OK in VB. The dll was = registered=20 in Registry: same error.
 
Public Function calc(intVal1 As Integer) As = Integer
   =20 calc =3D -intVal1
End Function
 
 
 

# A similar example given in "Pragmatic Programmer"  works = finr!
 
# Please Help
 
V V Kanetkar
------=_NextPart_000_0058_01C40103.8627C720-- ------=_NextPartTM-000-1542728c-d567-4249-85d7-1025f88d4cfa--