Unix Technical Forum

UDF creation with VC++ under Win32

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 ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 07:55 AM
cayci dmer
 
Posts: n/a
Default UDF creation with VC++ under Win32

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?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:08 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com