Board index » delphi » DLL Help

DLL Help

Hi,

I am trying to use functions from a DLL and I have a succesfully run this
demo program from within delphi1.0 .
When I try to run it in Delphi 4.0 I get an
 "EAccessViolation at address 10035593" in module ' Kit32.DLL'

Can anyone tell me why it can't access the function in the dll in delphi4.0
or give me an idea were to look?

Thanks,

Rene'

unit Demo;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, KIT32;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
     i1 : SmallInt;
     dt1 : SmallInt;
     sDate : array[0..15] of char;
     fOut : TextFile;
     b1 : fmBars;
     a1 : fmArray;

begin
     i1 := fmFILEread('txtinfo.txt', @b1, 'c:\source\kit51', 'ibm.txt', 0,
10, 1);
     i1 := fmAllocArray(@a1, b1.size);
     i1 := fmSimpleMA(@b1.cl, @a1, 6 , 0);

     AssignFile(fOut, 'study.txt');
     Rewrite(fOut);
     Writeln(fOut, 'Date       Close      MA ');
     Writeln(fOut, '----       -----      --');

     for i1 := 0 to b1.size - 1 do
     begin
        dt1 := StrToInt(FloatToStr(fmGetArrayItem(@b1.dt, i1)));
        fmJulianToDateTxt(dt1, DTFORMAT_YY_MM_DD, '/', @sDate);
        Write(fOut, sDate);
        Write(fOut, '  ');
        Write(fOut, FloatToStrF(fmGetArrayItem(@b1.cl, i1), ffFixed, 6, 3));
        Write(fOut, '  ');
        Writeln(fOut, FloatToStrF(fmGetArrayItem(@a1, i1), ffFixed, 6, 3));
     end;
     CloseFile(fOut);
     i1 := WinExec('notepad.exe study.txt', SW_SHOWNORMAL);

     fmFreeBars(@b1);
     fmFreeArray(@a1);

end;

end.

 

Re:DLL Help


Quote
rn wrote:

> Hi,

> I am trying to use functions from a DLL and I have a succesfully run this
> demo program from within delphi1.0 .
> When I try to run it in Delphi 4.0 I get an
>  "EAccessViolation at address 10035593" in module ' Kit32.DLL'

> Can anyone tell me why it can't access the function in the dll in delphi4.0
> or give me an idea were to look?

Problems like these are normally caused by mismatched
calling-conventions.  Delphi defaults to "register."  DLL authors
normally use "stdcall."  Delphi-16 did not have anything corresponding
to "register."

------------------------------------------------------------------------
Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259
mailto:i...@sundialservices.com  (PGP public key available.)

Quote
> Got Paradox/Delphi database headaches?  ChimneySweep{tm} can help, FAST!
> http://www.sundialservices.com/cs3web.htm

Re:DLL Help


Thanks for the help.
 I added       stdcall;external 'kit32.dll'  and it seems to work fine in
delphi 4 now.

Rene'

Quote
Sundial Services wrote in message <380CA0C5.7...@sundialservices.com>...
>rn wrote:

>> Hi,

>> I am trying to use functions from a DLL and I have a succesfully run this
>> demo program from within delphi1.0 .
>> When I try to run it in Delphi 4.0 I get an
>>  "EAccessViolation at address 10035593" in module ' Kit32.DLL'

>> Can anyone tell me why it can't access the function in the dll in
delphi4.0
>> or give me an idea were to look?

>Problems like these are normally caused by mismatched
>calling-conventions.  Delphi defaults to "register."  DLL authors
>normally use "stdcall."  Delphi-16 did not have anything corresponding
>to "register."

>------------------------------------------------------------------------
>Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259
>mailto:i...@sundialservices.com  (PGP public key available.)
>> Got Paradox/Delphi database headaches?  ChimneySweep{tm} can help, FAST!
>> http://www.sundialservices.com/cs3web.htm

Other Threads