Now i hate MySQL... ><
Head -> Table

Ach Sid... ich seh gerade du kommst aus Deutschland?
Ich komm an dem punkt einfach nit mehr weiter...

Hab nun versucht ne einzelne DLLFUNC zu schreiben, indem er einfach Daten von einem vordefinierten Server abruft und in einem Array zurückgibt... Aber dieses Crasht immer in der Main und sagt mir auch noch "Empty Function in main".

Irgendwelche Ideen?

Hier der Code (C++) - Lässt sich auch ohne Probleme compiliern

Code:
#include "mysql.h" // MySQL Include File

#define SERVER "localhost"
#define USER "root"
#define PASSWORD ""
#define DATABASE "cdcol"

MYSQL* testcon;

BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved) // this is where the DLL first starts.
{
 engine_bind(); 
 return TRUE;
}

DLLFUNC const char gs_mysqltest(const char *abfrage)
{
    MYSQL *connect; // Create a pointer to the MySQL instance
    connect=mysql_init(NULL); // Initialise the instance
	connect=mysql_real_connect(connect,SERVER,USER,PASSWORD,DATABASE,0,NULL,0);
    MYSQL_RES *res_set; /* Create a pointer to recieve the return value.*/
    MYSQL_ROW row;  /* Assign variable for rows. */
    mysql_query(connect,abfrage);
    unsigned int i = 0; /* Create a counter for the rows */
 
    res_set = mysql_store_result(connect); /* Receive the result and store it in res_set */
 
	my_ulonglong numrows = mysql_num_rows(res_set); /* Create the count to print all rows */
 
    /* This while is to print all rows and not just the first row found, */
	const char *testxx;
    while ((row = mysql_fetch_row(res_set)) != NULL){
		testxx=row[0];
		return *testxx;
  
    }
    mysql_close(connect);   /* Close and shutdown */
	return *testxx;
}



und in C-Lite:

Code:
...
const char gs_mysqltest(const char* abfrage);
...
const char *ausgabe;
ausgabe=gs_mysqltest("select * from cds");
...



Last edited by Waldnebel; 12/22/11 15:18.