I've tested the following in Delphi:
library ESPL;
uses
TWSLib_TLB;
function DLL(sTicker: shortstring; var dllfunction,nLast,nLastsize,nBid,nBidsize,nAsk,nAskSize,nVolume: variant): variant; stdcall;
var
tws: TTws;
begin
try
tws.connect('',7496,3);
DLL:=0;
except...