[fpc-pascal]mysql package under WinNT
Michael.VanCanneyt at Wisa.be
Michael.VanCanneyt at Wisa.be
Sun Mar 11 17:45:09 CET 2001
On Sun, 11 Mar 2001, Bernhard Steffen wrote:
> I tried using the mysql package under WinNT and got some weird errors.
> Here's what I found out to solve the problem:
>
> I couldn't get "make" to run - it always complained it cannot find
> /bin/sh, although I had copied sh.exe to /bin on every single drive I
> have...
>
> So I tried compiling the demo program testdb.pp by manually calling ppc.
> Compiling was fine, but linking always failed "could not find
> -lmysqlclient". I patched "link.res" and changed the INPUT() section:
> changed "-lmysqlclient", "-lm", "-lc" to just "mysqlclient.lib" and
> called ldw directly - which works fine, but seems a little bit awkward
> to me.
>
> So I investigated further and found out a slight error in mysql_com.pp:
> There is a section declaring the required libraries:
>
> {$linklib mysqlclient}
> {$linklib m}
> {$linklib c}
>
> This may work under LINUX (haven't tried), but doesn't under WinNT.
> Changing it to the following lines makes it work perfectly under WinNT
> as well:
>
> {$ifdef win32}
> {$linklib mysqlclient.lib}
> {$else}
> {$linklib mysqlclient}
> {$linklib m}
> {$linklib c}
> {$endif}
>
> (Leaving out the file extension ".lib" brakes linking for WinNT again.)
You must be using an older version of the mysql units;
the version that is currently in CVS contains the following code:
uses mysql_com;
{$ifdef win32}
Const mysqllib = 'libmysql';
{$else}
Const mysqllib = 'mysqlclient';
{$endif}
{$ifndef win32}
{$linklib c}
{$linklib m}
{$endif}
And I have tested this using mysql 3.22; Your using of the .lib library
may be suitable for you personally, but in general it is preferred to use
the libmysql.dll version; in that case the extension '.lib' is not needed.
>
> Maybe "make" takes care of this problem already - I don't know, since
> make does not work on my computer yet. On the other hand, if you apply
> this patch, you can compile it directly (mysqlclient.lib needs to be in
> a path defined by "-Fl" option, "libmysql.dll" needs to be in path at
> runtime of your program). Maybe someone can include this into the
> official distribution?
As you can see, the problem has been remedied.
Michael.
More information about the fpc-pascal
mailing list