Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Delphi DLL - always getting 0 as a function result

Author
Message
Proof88
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Budapest, Hungary
Posted: 4th Aug 2005 21:22
Hi!

I work on a Dll in Delphi. I use the 'stdcall' calling directive for the functions and procedures and it works well when I pass integer-type parameters to a function from darkbasic or when I pass function result to darkbasic.
But I have problems with passing floating-point variables! I selected the Single type in delphi for the floating-point variables because I think DB uses 4 bytes to store real values. When I try to pass a real value from DB to a dll function it works well, too. However, if I try to pass a real (single-type) value as a function result from the dll to DB, DB always gets 0.
I have already tried with other real types like Real,Extended,etc. but DB always gets 0.
Would you be so kind to help me?
I look forward to hearing from you!

Thanks,
Ádám Szabó
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 6th Aug 2005 14:31 Edited at: 6th Aug 2005 14:32
DBpro expects function results in the EAX register no matter what type they are. That means you need to use the following approach:



Play Nice! Play Basic! Version 1.08
Proof88
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Budapest, Hungary
Posted: 12th Aug 2005 18:43
Ahh thanx for that!

I use DB Classic but it works there, too!
Many thanks for that!!!

Login to post a reply

Server time is: 2024-11-21 18:52:25
Your offset time is: 2024-11-21 18:52:25