[DUG] Dll issue

Conor Boyd Conor.Boyd at trimble.co.nz
Wed Jul 18 14:45:24 NZST 2007


If you're not already using madExcept to log/trap unhandled exceptions,
you might like to give that a go, see if it gives you more info.

www.madshi.net

Cheers,

C.

-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
On Behalf Of Robert martin

Thanks Rohit

Trapping the exception in the dll and trying to show the message also
fails (the app still disappears).  But a good suggestion (Should have
tried that 'much' earlier.


Rohit Gupta wrote:
> I dont know about widestrings, but ansistrings can be a problem with 
> dlls.  Also note that if written in Delphi you have to handle all 
> exceptions inside the dll.... as the exception itself uses ansistring.
>
> Robert martin wrote:
>> Hi again
>>
>> Further to my previous email I want to check that I have this right.

>> I think I am doing something wrong in relation to passing variables.
>>
>> My dll Call is defined as
>>
>>  TRunEFTPOS = Function(var Amount, CardType, ResCode: WideString; 
>> Account, MercRef, TransRef, HeaderLine, FooterLine : WideString) :
>> Boolean;
>>
>> Note is users var parameters.
>>
>>
>> This is my test calling code
>>
>> var
>>    RunIt           : TRunEFTPOS;
>>    EFTPOSHandle    : THandle;
>>    ARes            : WideString;
>>    CardType        : WideString;
>>    iRes            : Integer;
>>    Amt             : Extended;
>>    TestAmt         : WideString;
>>    Authorised      : Boolean;
>> begin
>>  inherited;
>>    //RUN DLL
>>
>>    CardType := '';
>>    Amt :=  10.95;
>>    TestAmt := FloatToStr(Amt);
>>
>>    EFTPOSHandle := LoadLibrary('EftPos.dll');
>>    if (EFTPOSHandle <> 0) then begin
>>        try
>>            @RunIt := GetProcAddress(EFTPOSHandle, 'RunIt');
>>
>>            if (@RunIt <> nil) then begin
>>                Authorised := RunIt(TestAmt, CardType, ARes, '1', '1',

>> '12345' , 'Test eftpos', 'Test');
>>                iRes := StrToIntDef(ARes, -1);
>>
>>                if (Authorised = True) then begin
>>
>>                    ShowMessage(TestAmt);
>>                end;
>>            end;
>>        finally
>>            FreeLibrary(EFTPOSHandle);
>>        end;
>>    end;
>>
>>
>>
>>
>> Could passing var parameters be the root cause of my problem?  (This 
>> Dll was working fine previously)
>>
>> Also the calling app has Sharemem in the uses clause but the dll does

>> not.  Adding it to the dll causes an av 'after' running the dll in 
>> the test app, the main app still dies at the start.
>>
>> Any comments would be appreciated.
>>
>> Robert martin wrote:
>>> Hi
>>>
>>> I have been using a (home made) DLL to interface between our app and

>>> an eftpos systems ActiveX control.  All worked well until we updated

>>> their software.  Now my app blows away when I try to create the 
>>> ActiveX (in the dll).  However after much testing I have discovered 
>>> if I call the dll from behind a TAdvGlowButton (fancy glowing
>>> button) it works ! but I get an error in GDIPlus.dll after the first

>>> time.
>>>
>>> It seems to be some sort of issue between the dlls being used 
>>> (GDIPlus.dll and eftpos.Dll



More information about the Delphi mailing list