DevOTechS Forums
December 10, 2018, 02:55:58 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: DevOTechS forums
 
   Home   Help Search Calendar Login Register  
Pages: [1]
  Print  
Author Topic: Delphi 2006  (Read 9333 times)
Theo
Newbie
*
Posts: 1


View Profile
« on: September 23, 2008, 11:14:45 AM »

Greetings, I am a Delphi 2006 user and I am having trouble using Hime.dll .

First of all I used the HimeLib.pas given in the delphi example (made by Joγo Inαcio) and the only thing I added was a wrapper for hi_Hex2Huge in order to be able to use hex strings.

So far I've been able to put string data in HIME registers and retrieve them in order to validate that the contents of the registers are correct. The problem is that whenever I call one function (eg. hi_PowMod) the program gives me an "Access violation at address 004D11AE in module 'hime.dll'. Read of address 00000003." error.

I used the same data at your HIMEworkbench and it completed successful so I guess I am doing something wrong.

my function looks like that:

function MyPowMod(s1,s2,s3: String): String;
begin
  Hime.PutReg(1,s1,hi_Hex);
  Hime.PutReg(2,s2,hi_Hex);
  Hime.PutReg(3,s3,hi_Hex);
  Hime.HugePowMod(1,2,3,4);
  result:=Hime.GetReg(4,hi_Hex);
end;

Thanks for any help in advance Smiley
Logged
Admin
Administrator
Newbie
*****
Posts: 9



View Profile WWW
« Reply #1 on: September 23, 2008, 11:49:27 AM »

Hi Theo,

Welcome on these forums !

HIME function parameters are passed (to HIME) by reference (and not by value). I think that this is the cause of your problem.
If a function parameter is passed by reference, the (HIME) function receives an address of the parameter and not the actual parameter value itself.
If you pass a parameter by value, its value is passed to HIME but HIME expects an address and interpretes the parameter value as an address.
That is why the error message reports "Read of address 00000003.". Probably, your function call passes the parameter value of 3, and HIME thinks that this is an address and tries to fetch the parameter at that address, which causes the access violation because that address does not belong to your program space.

So, please retry by passing the parameters to the HIME functions by reference.
I believe in Delphi this is done by using the "var" keyword in your function declarations.

Could you let me know if that did the trick ?   Smiley

Kind regards
Eddy
Logged

www.devotechs.com
HIME - Huge Integer Math and Encryption Library
NUMS - Arbitrary Precision Floating Point Math library
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!