Using libmysql.dll via "loadLibrary()"

Using libmysql.dll via "loadLibrary()"

Postby JC » Fri Jul 25, 2008 12:14 pm

Dear Antonio and friends of forum!

I have tried to connect into a mysql server calling the functions of libmysq.dll with loadLib32() function.

The function mysql_init() for prepare the threads and environment to connect on the database server is running perfectly! I get a code handle for this!

But, some functions like mysql_real_connect() and others... they are not running correctly.

The fivewin, at runtime, crashing with a GPF error!

Bellow, I describe my code... Please, help me!


Code: Select all  Expand view
# include "Fivewin.ch"

STATIC cMySqlLib32
STATIC hHandleConexao

// ------------
FUNCTION main()
// ------------

cMySqlLib32 := loadLib32( "libmysql.dll" )

hHandleConexao := mysql_init()

IF !mysql_real_connect( hHandleConexao, "127.0.0.1", "root", "mysql", NIL, 0, NIL )
   ? "Not connected!"
ELSE
   ? "Connected!"
ENDIF

mysql_close( hHandleConexao )

RETURN( NIL )


*** *************************************** ****
*** Declaration of funciotns at libmysq.dll ****
*** *************************************** ****
DLL32 STATIC FUNCTION mysql_init( mysql AS LPSTR ) AS LONG PASCAL FROM "mysql_init" LIB cMySqlLib32
DLL32 STATIC FUNCTION mysql_close( mysql AS LPSTR ) AS LONG PASCAL FROM "mysql_close" LIB cMySqlLib32

DLL32 STATIC FUNCTION mysql_real_connect( mysql AS LPSTR, ;
                                          host AS LPSTR, ;
                                          user AS LPSTR, ;
                                          passwd AS LPSTR, ;
                                          db AS LPSTR, ;
                                          port AS LPSTR, ;
                                          unix_socket AS LPSTR, ;
                                          client_flag AS LPSTR ) AS BOOL PASCAL FROM "mysql_real_connect" LIB cMySqlLib32
Last edited by JC on Tue Jul 29, 2008 6:19 pm, edited 1 time in total.
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby JC » Fri Jul 25, 2008 6:18 pm

Nobody?
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby ShumingWang » Sat Jul 26, 2008 12:48 am

JC,
Pls import libmysql.lib from libmysql.dll ,link libmysql.lib,mysql.lib (tmysql.prg,mysql.c,mysql.ch,mysql server 5.0/include ) into your app, you can directly use tmysql.prg .
Regards!
Shuming Wang
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Postby Antonio Linares » Sat Jul 26, 2008 4:50 am

Please use LoadLibrary() and DLL FUNCTION ...

LoadLib32() and DLL32 FUNCTION are for 16 bits apps.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby JC » Mon Jul 28, 2008 11:14 am

ShumingWang wrote:JC,
Pls import libmysql.lib from libmysql.dll ,link libmysql.lib,mysql.lib (tmysql.prg,mysql.c,mysql.ch,mysql server 5.0/include ) into your app, you can directly use tmysql.prg .
Regards!
Shuming Wang


Shuming, I tried to use the libmysql.lib but, returns the following error:

Code: Select all  Expand view
Error: 'H:\FWH8.06\FWH\SAMPLES\LIBMYSQL.LIB' contains invalid OMF record, type 0
x21 (possibly COFF)
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby JC » Mon Jul 28, 2008 11:15 am

Antonio Linares wrote:Please use LoadLibrary() and DLL FUNCTION ...

LoadLib32() and DLL32 FUNCTION are for 16 bits apps.


Dear Linares, thank for trip.... I will use!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby ShumingWang » Tue Jul 29, 2008 2:17 am

JC,
Genarate libmysql.lib from libmysql.dll, libmysql.dlls are different among different Mysql versions.
\bcc55\bin\implib.exe libmysql.lib libmysql.dll
Regards!
Shuming Wang
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Postby JC » Tue Jul 29, 2008 4:42 pm

ShumingWang wrote:JC,
Genarate libmysql.lib from libmysql.dll, libmysql.dlls are different among different Mysql versions.
\bcc55\bin\implib.exe libmysql.lib libmysql.dll
Regards!
Shuming Wang


Thanks Shuming... it's work! I will try now!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby JC » Tue Jul 29, 2008 4:55 pm

Shuming, it's work now with libmysql.lib via implib.exe

But, the function mysql_real_connect() still not recognized :(

I will go work better! Thanks for all!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 52 guests