From: gregarican Date: 2005-10-09T08:01:51+09:00 Subject: Ruby/DL Question I am trying to call a method included in a Windows DLL file. Judging by the C header file that this DLL is created from and judging from the API documentation I think I have the various parameters needed. But the return code seems to be different. I have commented my code to include the C header details as well as a sample C program that accesses this method. Anyone know what I am missing? I guess I'm confused because the method is supposed to return an integer result code, but also returns a pointer called acsHandle. I thought only one thing could be returned and that's why my Ruby code is just returning the acsHandle pointer... =begin acsOpenStream method based on TSAPI acsOpenStream ( acsHandle /* RETURN */ invokeIDType, /* INPUT */ invokeID, /* INPUT */ streamType, /* INPUT */ serverID, /* INPUT */ loginID, /* INPUT */ passwd, /* INPUT */ applicationName,/* INPUT */ acsLevelReq, /* INPUT */ apiVer, /* INPUT */ sendQSize, /* INPUT */ sendExtraBufs, /* INPUT */ recvQSize, /* INPUT */ recvExtraBufs, /* INPUT */ privateData /* INPUT */); here's an example of this in C rCode=acsOpenStream(acsHandle,invokeIDType,invokeID,streamType, serverID,loginID,passwd,applicationName,acsLevelReq, apiVer,sendQSize,sendExtraBufs,recvQSize,recvExtraBufs, privateData); if (rCode < 0)< { printf("acsOpenStream failure..."); return; } else { printf("acsOpenStream success\n"); invokeID=rCode; } =end # here's my Ruby code require 'dl' csta=DL.dlopen('csta32.dll') openStream=csta['acsOpenStream', 'PSISSSSSISIIIIS'] results=openStream.call("LIB_GEN_ID",0,"ST_CSTA","AVAYA#MERLIN#CSTA#MERLIN-CTI\000","username\000","password\000","CTI Test\000",2,"TS2",0,0,0,0,nil) p results # my results show as # [#, ["LIB_GEN_ID",0,"ST_CSTA","AVAYA#MERLIN#CSTA#MERLIN-CTI\000","username\000","password\000","CTI Test\000",2,"TS2",0,0,0,0,nil]]