|
mysql_server_init embedded in a DLL?: msg#00156db.mysql.windows
Hi! I am trying to create a DLL that will hide embedded mySQL functions for use with VB. I am using mysqlserver.lib. I am able to compile and execute the following code. This has to be done in C because VB is too slow :-( If mysql_server_init function is run in the DLL from Visual Basic. I get the following error message: "..referenced memory at "0x000000". The memory could not be read". Without the mysql_server_init function it will run correctly. It will also run correctly when this is compiled as a .lib file linked to a C program. Is it possible to embed mysql_server_init in a DLL? (So the DLL can be used in VB) Thanks in advance for any responses. Thanks Eric header1.h #define GPAPI __stdcall header2.h typedef unsigned long DBS; #define NULLDBS (DBS)0 api.c GPAPI DBS dbNewSet (char * basedir, char * datadir, char * dbname) { return NewSet(basedir,datadir,dbname); } newset.c extern DBS NewSet(char * basedir, char * datadir, char * dbname) { DBSET* pSet = CreateSet(); char *args[3]; char strArgs[3][1024]; int iRtn; int argc = 3; strcpy(strArgs[0],"this_program"); sprintf(strArgs[1],"--basedir=%s",basedir); sprintf(strArgs[2],"--datadir=%s",datadir); args[0]= strArgs[0]; args[1]= strArgs[1]; args[2]= strArgs[2]; /* If I comment out this line of code, the DLL will run correctly. If mysql_server_init function is run in the DLL. I get the following error message: "..referenced memory at "0x000000". The memory could not be read" */ iRtn = mysql_server_init(3, args, server_groups); if (pSet ==0 ) return NULLDBS; memset(pSet, 0, sizeof(DBSET)); /* Zero the structure. */ pSet->size = sizeof(DBSET);/* Assign structure size. */ pSet->magic = DBS_MAGIC; /* Assign magic number. */ return (DBS)(void*)pSet; } _________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail --------------------------------------------------------------------- Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before posting. To request this thread, e-mail win32-thread10625@xxxxxxxxxxxxxxx To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail win32-unsubscribe@xxxxxxxxxxxxxxx instead. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | wait_timeout variable can't be set in MySQL 4.0.9-gamma-nt: 00156, Bil Corry |
|---|---|
| Next by Date: | Kill a specific PID?: 00156, Guy Gordon |
| Previous by Thread: | wait_timeout variable can't be set in MySQL 4.0.9-gamma-nti: 00156, Bil Corry |
| Next by Thread: | Kill a specific PID?: 00156, Guy Gordon |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |