Board index » delphi » Calling a Delphi 1.0 DLL from Delphi 2.0??

Calling a Delphi 1.0 DLL from Delphi 2.0??

I have a DLL made with Delphi 1.0 with lots of functions that I try to call
from my Delphi 2.0 program. The program compiles (ctrl F9) ok, but when I try
to run it (F9) I get the message "De{*word*81} kernel error. Error code: 1". If I
try to run the exe-file I get a message that says that the DLL is corrupted.
Is all this because I try to call a 16 bit DLL from a 32 bit program? I have
replaced Integer with Smallint. The declaration unit looks like this (the DLL
is called LISALIB.DLL and Kvekk is one of the functions):

unit DLLdef;

Interface
.
function  Kvekk( var TekstH: Word): smallint;
.
implementation
.
function  Kvekk; external 'LISALIB';
.
end.

And I call the Kvekk-function as follows:
procedure TMainForm.MnuFilSpesrappClick(Sender: TObject);
var
   parm: word;
begin
   parm:=10;
   Kvekk(parm);
end;
end.

Can someone --please-- help me with thisgive me some good ideas? I have looked
through several FAQs without any luck.

----------------------------
Frank Johannessen
GG Data AS, Norway
fr...@ggdata.no

 

Re:Calling a Delphi 1.0 DLL from Delphi 2.0??


Quote
fr...@ggdata.no (Frank Johannessen) wrote:
>I have a DLL made with Delphi 1.0 with lots of functions that I try to call
>from my Delphi 2.0 program. The program compiles (ctrl F9) ok, but when I try
>to run it (F9) I get the message "De{*word*81} kernel error. Error code: 1". If I
>try to run the exe-file I get a message that says that the DLL is corrupted.
>Is all this because I try to call a 16 bit DLL from a 32 bit program?

Yes. The only way to do this is 'thunking', a poorly documented and
awkward interface that converts your 32 bit addresses into 16 bit
addresses. Delphi doesn't do anything to make this easier, but it's no
harder than other systems too.
----------------------------------------
Aandi Inston  qu...@dial.pipex.com
Visit http://ds.dial.pipex.com/quite for info on PostScript,
PSAlter, psalters, tea, and small {*word*141} animals. And stuff.  

Re:Calling a Delphi 1.0 DLL from Delphi 2.0??


Quote
Frank Johannessen wrote:

> I have a DLL made with Delphi 1.0 with lots of functions that I try to call
> from my Delphi 2.0 program. The program compiles (ctrl F9) ok, but when I try
> to run it (F9) I get the message "De{*word*81} kernel error. Error code: 1". If I
> try to run the exe-file I get a message that says that the DLL is corrupted.
> Is all this because I try to call a 16 bit DLL from a 32 bit program?

        Yup. As long as it's your own dll why not just recompile the dll
in D2?

--
David Ullrich
Sig file accidentally deleted - sorry.

Other Threads