Thomas Peters wrote: > This is a simple snippet of C code to test a connection to MySQL database. > It uses the native C API from MySQL library. I am interested in learning > how this can be converted into a FB Function. I noticed the WebServices > example uses BeginCFunction >> EndC code block. > > <snip> You would first have to obtain and install mysql, because it is not part of OS X. Then something like this should compile (but with link-time errors): '-------------- include "CommandLineTool" BeginCDeclaration #include <mysql/mysql.h> #include <stdio.h> #include <string.h> int Test(); EndC BeginCFunction int Test() { MYSQL mysql; MYSQL_RES *res; MYSQL_ROW row; char query[80]; mysql_init(&mysql); mysql_real_connect(&mysql,"some.host.com","ipaudit","letmein","audit",0,NULL,0); sprintf(query,"SELECT src,dst FROM ipaudit"); mysql_real_query(&mysql,query,(unsigned int)strlen(query)); res = mysql_use_result(&mysql); while(row = mysql_fetch_row(res)) printf("%s %sn",row[0],row[1]); mysql_free_result(res); return 0; } EndC toolbox fn Test = SInt32 // main fn Test '-------------- Lastly, for correct linking you will need to put a link option in 'More compiler options' in FBtoC settings. This may be as simple as -lmysql. Robert P.