[fpc-pascal] linking to dll still fails

Marc Santhoff M.Santhoff at t-online.de
Sat Jun 7 07:52:22 CEST 2008


Hi,

I still have no success in linking against a dll on windows.

The dll import source looks like this:

...
{$linklib 'hdf5'}
...
function H5open:herr_t;{$ifdef BSD}cdecl{$endif}{$ifdef Win32}stdcall{$endif};external;
function H5close:herr_t;{$ifdef BSD}cdecl{$endif}{$ifdef Win32}stdcall{$endif};external;
...

and compiles okay.

The demo program used for testing does the obvious:

...
uses {$ifdef FreeBSD} BaseUnix { size_t an friends }, {$endif}
     hdf5;
...

and uses functions normally as declared in the unit hdf5.

On FreeBSD this works as expected, on window it doesn't. Using -vv gave
(shortened, can be posted in full lenght):

00008000:Searching file D:\FPC\2.2.0\units\i386-win32\.\libhdf5.a... not found
00008000:Searching file D:\FPC\2.2.0\units\i386-win32\libhdf5.a... not found
00008000:Searching file D:\FPC\2.2.0\BIN\I386-WIN32\libhdf5.a... not found
00008000:Searching file D:\FPC\2.2.0\BIN\I386-WIN32\libhdf5.a... not found
00008000:Searching file hdf5.dll... found
....

00008000:Searching file D:\FPC\2.2.0\units\i386-win32\.\libhdf5.a... not found
00008000:Searching file D:\FPC\2.2.0\units\i386-win32\libhdf5.a... not found
00008000:Searching file D:\FPC\2.2.0\BIN\I386-WIN32\libhdf5.a... not found
00008000:Searching file D:\FPC\2.2.0\BIN\I386-WIN32\libhdf5.a... not found
10000002:Error: Import library not found for hdf5

...

00020000:Number of unresolved externals in objects 123
00020000:Number of unresolved externals after static libraries 123
00020000:Number of unresolved externals after defining COMMON symbols 123
00020000:Number of unresolved externals after DLL imports 55
10000002:Error: Undefined symbol: _H5Aopen_name
10000002:Error: Undefined symbol: _H5Aget_type
10000002:Error: Undefined symbol: _H5Aget_space
10000002:Error: Undefined symbol: _H5Sget_simple_extent_ndims
10000002:Error: Undefined symbol: _H5Sget_simple_extent_dims
10000002:Error: Undefined symbol: _H5Tget_class
10000002:Error: Undefined symbol: _H5Sget_simple_extent_npoints
10000002:Error: Undefined symbol: HDF5_H5AREAD$LONGINT$LONGINT$POINTER$$LONGINT
10000002:Error: Undefined symbol: _H5Tclose
10000002:Error: Undefined symbol: _H5Sclose
...

I have only adjusted some basic functions to use stdcall instead of
cdecl on windows, so ignore the lines about undefined symbols having an
underscore at the start.

The dll is in the program directory. And it does get found. Another
issue might be:

in the units target dir there are three files:

-rw-rw-rw-   1 user     group       77104 Jun  7 05:45 hdf5.o
-rw-rw-rw-   1 user     group      154410 Jun  7 05:45 hdf5.ppu
-rw-rw-rw-   1 user     group           8 Jun  7 05:45 libimphdf5.a

If I assume the libimphdf5.a is the missing import library and look at
it:

!<arch>

That's in there, nothing else (8 bytes).

What's going wrong here, how can I make it work?

TIA,
Marc





More information about the fpc-pascal mailing list