[DUG] Dll issue
Rohit Gupta
rohit at cfl.co.nz
Wed Jul 18 13:56:40 NZST 2007
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.
>
>
>
>
> 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 ?
>>
>>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with
> Subject: unsubscribe
>
>
--
*Rohit Gupta*
* B.E. Elec. M.E. Mem IEEE Associate IEE*
*Technical Manager*
*Computer Fanatics Limited*
**
*Tel* +64 9 4892280
*Fax* +64 9 4892290
*Email *rohit at cfl.co.nz <mailto:rohit at cfl.co.nz>**
*Web *www.cfl.co.nz <http://www.cfl.co.nz/>
------------------------------------------------------------------------
This email and any attachments contain information, which is
confidential and may be subject to legal privilege and copyright. If you
are not the intended recipient, you must not use, distribute or copy
this email or attachments. If you have received this in error, please
notify us immediately by return email and then delete this email and any
attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.adventureeducation.co.nz/pipermail/delphi/attachments/20070718/2b7cefcf/attachment.html
More information about the Delphi
mailing list