This is a discussion on UDF creation with VC++ under Win32 within the MySQL forums, part of the Database Server Software category; --> Hi, I am trying to create a UDF in MYSQL 5 using VC++. Since I've found little examples, I've ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I am trying to create a UDF in MYSQL 5 using VC++. Since I've found little examples, I've tried something like that, this is a C code for getting HDD's serial number: --begin c code-- #include "windows.h" #include "mysql.h" my_bool HDDSerial_init(UDF_INIT *initid, UDF_ARGS *args, char *message); void HDDSerial_deinit(UDF_INIT *initid); char* HDDSerial(); my_bool HDDSerial_init(UDF_INIT *initid, UDF_ARGS *args, char *message) { return 1; } void HDDSerial_deinit(UDF_INIT *initid) { } char* HDDSerial() { char VolumeNameBuffer[256]; unsigned long VolumeSerialNumber; unsigned long MaximumComponentLength; unsigned long FileSystemFlags; char FileSystemNameBuffer[256]; GetVolumeInformation( "C:\\", VolumeNameBuffer, sizeof(VolumeNameBuffer), &VolumeSerialNumber, &MaximumComponentLength, &FileSystemFlags, FileSystemNameBuffer, sizeof(FileSystemNameBuffer) ); return("VolumeSerialNumber"); } --end c code-- When I compile that project in VC++ and put the DLL in System32, then run that query: "CREATE FUNCTION HDDSerial RETURNS STRING SONAME "HDDSerial.dll";" , I get: "Can't find function 'HDDSerial_init' in library" What am I doing wrong OR is there a cuter alternative way to get serial number in MySQL? |