[fpc-pascal] Converting Delphi7 code to FreePascal with interfacing to protection key?
Bo Berglund
bo.berglund at gmail.com
Wed Mar 29 19:16:34 CEST 2023
On Wed, 22 Mar 2023 14:17:23 +0100, Sven Barth via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:
>Then you should ask them for a suitable 64-bit object file (I assume that
>they'll provide the one for C which they probably also did for you back
>then and then you might need to adjust the import unit a bit to be usable
>with x86_64-win64; as long as they also provide a C header that should be
>doable).
>
Back here again after I raised a ticket with Thales and got a response!
I think they provide something that will work with Delphi rather than for C.
The reply from THALES is linking to no less than 7 different archive files for
various use of the keys.
In one of these I found an example for *Delphi 10*, which contained an updated
interface file and a 32 bit object file:
spromeps.pas
superpro.obj
(I do not think I even ever had Delphi 10...)
I copied these to my project and disabled the old versions.
Then I tried to cross-compile to Win32 on Lazarus 2.2.4 and Fpc 3.2.2.
Syntax check (Run/Quick_Compile) finishes successfully.
But the Compile does not, it fails like this:
---------------------
Compile Project, Mode: Default, OS: win32, CPU: i386, Target: DongleTest.exe:
Exit code 1, Errors: 1
DongleTest.lpr(28,1) Error: Illegal COFF Magic while reading
D:\Engineering\Projects\Subversion\PC\DongleTest\superpro.obj
---------------------
The same happens if I set the target to default everywhere so going for 64 bit.
In tyhis case I had to switch to the spromeps.pas superpro.obj files from the
same archive but for 64 bit applications.
Here the error when I try to compile:
----------------------
Compile Project, Mode: Default, Target: DongleTest.exe: Exit code 1, Errors: 1
DongleTest.lpr(28,1) Error: Failed reading coff file, illegal reloctype $000A
while reading D:\Engineering\Projects\Subversion\PC\AgiDongleTest\superpro.obj
----------------------
So again I have the problem with the obj file(s) which are now more recent than
the old single one.
How can I check the obj file for "type"?
I have asked this before here but now cannot find if I got an answer or not...
Is there some command I can use to check what kind of an obj file I have?
Is it possible to find anything by looking at the interface file spromeps.pas,
which is the interface from the main application towards the obj file?
ThHis pretty much looks like the old file to me except it has more available API
calls and also some defines for MSWINDOWS and LINUX respectively in the
implementation part defining all the API calls into the driver.
My problem is that I do not have any Delphi on my new (from 2019) laptop except
Delphi-7...
So I guess I have to check if my test app can be opened in Delphi7 using the
supplied obj file and if it works there, how do I proceed?
TIA
--
Bo Berglund
Developer in Sweden
More information about the fpc-pascal
mailing list