'Shapelib.dll does not work properly on Win 64 Platform (Delphi 10.3)

Shapelib is a library originally written in C, which provides the ability to write simple programs for reading, writing and updating ESRI Shapefiles.

I managed to compile shapelib.dll for 32bit and 64bit on the basis of https://github.com/OSGeo/shapelib and then I wanted to test if that works with the help of ShapeFileII.pas (available in that repo).

I am using Delphi 10.3. I started with Win32 and I wrote simple program which opens .shp file and reads geometry type and coordinates. Everything worked exactly how I wanted.

Then I add Win64 platform and wanted to test it. Unfortunately, program does not work properly on Win64. I can read only geometry type, other info like coordinates etc. are mostly null.

Did someone try to use shapelib library? Could you give me a hint? Maybe there is some distincion between Win 32/64 data types?

I appreciate any kind of help.

Update

To be more precise, I added screenshot covering the same test object on Win32 and Win64. Running on Win32 gives me values just how i want - I need especialy nVertices and padfX, padfY, padfZ. Running on Win64 gives me incorrect value of nVertices (0) and weird one-line displacement (padfX in Win32 is now padfY in Win64).

Screenshot



Solution 1:[1]

Besides eventual 32/64 bit related issues,

ShapeFileII.pas

That's a 20 years old legacy code.

I would recommend using the free ArcView ShapeFile OCX and DLL, instead.

VB6 OCX & DLL, .NET 64bit specific and AnyCPU DLLs are included.

Pascal code snippets used to be included in the library's docs, as far as I remember.

In any case better check the author's repository:

https://github.com/rosspickard/ArcShapeFile

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 LuisTavares