Title: Delphi 2006 Post by: Theo 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 :) Title: Re: Delphi 2006 Post by: Admin 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 ? :) Kind regards Eddy |