[fpc-pascal]mysql package under WinNT

Bernhard Steffen bernhard.steffen at gmx.net
Mon Mar 12 21:45:03 CET 2001

To Michael.VanCanneyt at Wisa.be's reply:

> 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';
> [...]

That's the code I found in mysql.pp - mysql_com.pp had the other one. I
downloaded these files just a couple of days ago from freepascal.org.
File dates of mysql.pp and mysql_com.pp within the zip file are

> 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.

Before I received your reply, I tried leaving out the {$linklib} section
at all in mysql_com.pp - it worked. I guess, this is because it is
already included in mysql.pp, so the linker knows where to look? So
basically, I just have to fix my version of mysql_com.pp.

... which I just did (copying the lines from mysql.pp to mysql_com.pp),

But I just ran into another problem: When using the demo program
"testdb.pp", everything works fine. If I leave out the section at the
beginning of the program ("if paramcount=1 then begin Dummy:=Paramstr(1)
..."), my program halts with runtime error 103 (file not open). But
since I ran this program without a command line parameter, these
statements should never get executed, so it shouldn't make any
difference if I leave them out.

Later this evening I tried to set up my own mysql interface unit, since
I would like to have an easier error handling (internal error handler
gets called automatically after each call to mysql) as well as automatic
connection opening (and closing).

Now my program halts shortly after the mysql_connect call. A first
"writeln" statement will get printed, subsequent "writeln" won't, even
if there's no other function call in between. Program halts with either
"access violation: address 00000000: read of 0000000" (WinNT error
popup) or "runtime error 103" (fpc; first writeln statement after call
to mysql_connect).

Any ideas? I'm using Windows NT 4, FPC 1.04 (downloaded 2001-01-01).
I've no debugger set up, but I'm compiling my program with "-gl -gh
-ddebug". heaptrc says "No heap dump by heaptrc unit".

Any help appreciated. Thank you.


P.S.: Connecting to mysql via the mysql client works fine, so mysqld is
up and running. I'm using 3.22.32 (Ver 9.38)

bernhard.steffen at gmx.net

More information about the fpc-pascal mailing list