From: Chintakrindi Meghanath Date: 2006-07-19T06:39:38+09:00 Subject: Calling DLL from Ruby ------_=_NextPart_001_01C6AAB2.A719D382 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi All=20 =20 Recently I was trying to call an open source tool (STAF) from = Watir(Ruby). =20 I am supposed to call DDVariableStore.dll =20 But when the program is being executed, I get the error :- =20 D:/Program Files/Watir/unittests/11.rb:6:1n 'initialize': = GetProcAddress: STAFUtilities or STAFUtilitiesA from D:/Program Files/Watir/unittests/11.rb:6 =20 The program code is=20 =20 require 'Watir' require 'Win32API' class STAF_Watir_Interface def processRequest(otrd) oresult =3D Win32API.new("DDVariableStore","STAFResult","","") ostaf =3D otrd.getSTAFHelper() status =3D ostaf.sendQueueMessage(debuglog, sinfo & "HookScript = processing request...") otrd.setStatusCode(-1) otrd.setStatusInfo("") message =3D "I did good on line "& otrd.getLineNumber() details =3D "I deserve something special!" status =3D ostaf.logPassedMessage(otrd.getFac(), message, details, = oresult) processRequest =3D otrd.getStatusCode() end engine =3D "SAFS/Watir" shutdown =3D "False" =20 astaf =3D Win32API.new ("DDVariableStore","STAFUtilities","","") otrd =3D Win32API.new("DDVariableStore","TestRecordData","","")=20 oresult =3D Win32API.new("DDVariableStore","STAFResult","","") otrd.setSTAFHelper(ostaf) status =3D ostaf.registerNewProcess(engine) handleid =3D ostaf.getHandleID() status =3D ostaf.sendQueueMessage(debuglog, sinfo & "HookScript = initializing...") status =3D ostaf.resetHookEvents(engine) status =3D ostaf.postEvent(engine & "Start") while (shutdown =3D=3D False) do status =3D ostaf.sendQueueMessage(debuglog, sinfo & "HookScript = Ready") status =3D ostaf.postEvent(engine & "Ready")=20 status =3D ostaf.getNextHookTestEvent(engine) status =3D ostaf.sendQueueMessage(debuglog, sinfo & "HookScript = Dispatched") otrd.reinitialize() status =3D ostaf.getTestRecordDataVariant(otrd) record =3D otrd.getInputRecord() if record =3D=3D "SHUTDOWN_HOOK" then shutdown =3D "True" end if (shutdown =3D=3D "False") then status =3D processRequest(otrd) status =3D ostaf.sendQueueMessage(debuglog, sinfo & "HookScript = Results: "& status)=20 status =3D ostaf.sendTestRecordResultsVariant (otrd) status =3D ostaf.setHookTestResultsEvents(engine, 2) status =3D ostaf.resetEvent(engine & "Running") else status =3D ostaf.sendQueueMessage(debuglog, sinfo & "HookScript = Shutting Down")=20 status =3D ostaf.postEvent(engine &"Results") end end status =3D ostaf.resetHookEvents(engine) status =3D ostaf.postEvent(engine &"Shutdown") status =3D ostaf.sendQueueMessage(debuglog, sinfo & "HookScript = Shutdown")=20 status =3D ostaf.unRegisterProcess () end =20 =20 Please correct me if my code is wrong. Please crosscheck if Win32API was used properly. The problem starts at this line ---- astaf =3D = Win32API.new("DDVariableStore","STAFUtilities","","") =20 Bye and Thanx in advance Meghanath =20 ------_=_NextPart_001_01C6AAB2.A719D382--