[fpc-pascal] linking to dll still fails
Marc Santhoff
M.Santhoff at t-online.de
Sun Jun 8 12:35:38 CEST 2008
Am Sonntag, den 08.06.2008, 11:34 +0200 schrieb Michael Van Canneyt:
>
> On Sat, 7 Jun 2008, Marc Santhoff wrote:
>
> > Am Samstag, den 07.06.2008, 10:24 +0200 schrieb Michael Van Canneyt:
> > >
> > > On Sat, 7 Jun 2008, Marc Santhoff wrote:
> > >
> > > > Hi,
> > > >
> > > > I still have no success in linking against a dll on windows.
> > > >
> > > > The dll import source looks like this:
> > > >
> > > > ...
> > > > {$linklib 'hdf5'}
> > >
> > > You should change this to {$linklib hdf5.dll} for windows. Otherwise the compiler
> > > will try to link to a static library.
> >
> > Nice pitfall, I didn't find that in the docs.
> >
> > But however, it did not make a change (see below). Meanwhile I adapted
> > the import statemments to be sure, but it doesn't help.
>
> Hm. what options did you specify on the command-line, and what options
> are in the configuration files ?
I'm using a standard configuration as generated by the installation.
That is stripped down to active lines:
<fpc.cfg>
# Allow goto, inline, C-operators, C-vars
-Sgic
# searchpath for units and other system dependent things
-FuD:\FPC\2.2.0/units/$FPCTARGET/
-FuD:\FPC\2.2.0/units/$FPCTARGET/*
-FuD:\FPC\2.2.0/units/$FPCTARGET/rtl
# searchpath for tools
-FDD:\FPC\2.2.0/bin/$FPCTARGET
# Always strip debuginfo from the executable
-Xs
# Write always a nice FPC logo ;)
-l
# Display Info, Warnings, Notes and Hints
-viwn
</fpc.cfg>
aside with using
{$mode objfpc}{$H+}
{$ifndef win32}
{$linklib hdf5}
{$else}
{$linklib 'hdf5.dll'}
{$endif}
in the source of h5_attribute.pas. This is a demo for the hdf5 package
and both are made using fpcmake:
<main Makefile.fpc>
#
# Makefile.fpc for HDF5 Bindings
#
programs=h5_attribute h5_compound h5_group h5_read h5_write \
test_lite test_image test_table
[package]
name=hdf5
version=1.6.5
[target]
;units=hdf5 hdf5_hl
units=hdf5
programs=
exampledirs=demo
[compiler]
;options=-CX -Xi -XD
options=-vv
[require]
packages=
libc=y
[install]
fpcpackage=y
prefix=$(FPCDIR)
[default]
fpcdir=$(FPCDIR)
[shared]
build=n
</main Makefile.fpc>
<main/demo Makefile.fpc>
[target]
programs=h5_attribute h5_compound h5_group h5_read h5_write \
test_lite test_image test_table
[require]
packages=hdf5
[install]
fpcpackage=y
[default]
fpcdir=$FPCDIR
[compiler]
;options=-CX -Xi -XD
;options=-vv -Fu.. -Fi..
options=-vv
</main/demo Makefile.fpc>
The variable $(FPCDIR) is set in the windows environment to the base of
the binary installation opf fpc:
set FPCDIR=D:\fpc\2.2.0\
The package is built and installed and has (as mentioned somewhere) a
mostly empty limimphdf5.a.
> >
> > Another part is to adapt the declaration of variables. Currently they
> > are defined like this:
> >
> > H5T_NATIVE_SCHAR_g : hid_t;cvar;external;
> >
> > and as you can see in the fpcdebug.txt the name mangling is wrong:
> >
> > 10000002:Error: Undefined symbol: _H5T_NATIVE_SCHAR_g
> >
> > How does it have to be defined for Windows?
>
> No idea; it probably depends on the used C compiler ?
IIRC this is MSVC in version 6 or so. I'll look after that.
Marc
More information about the fpc-pascal
mailing list