[DUG] Dll issue

Robert martin rob at wildsoft.co.nz
Wed Jul 18 13:32:23 NZST 2007


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.




Rob Martin
Software Engineer

phone +64 03 377 0495
fax   +64 03 377 0496
web www.chreos.com

Wild Software Ltd



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
>
> Any ideas ?
>
>


More information about the Delphi mailing list