Bug #36947 Error occured on compiling udf_sample.dll on Windows.
Submitted: 26 May 2008 7:20 Modified: 26 May 2008 7:20
Reporter: Meiji KIMURA Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S3 (Non-critical)
Version:5.0.58 OS:Windows (with Visual Studio 2005)
Assigned to: CPU Architecture:Any

[26 May 2008 7:20] Meiji KIMURA
Description:
I tried to make udf_sample.dll on windows. I saw this link.

27.2.4.5. Compiling and Installing User-Defined Functions
http://dev.mysql.com/doc/refman/5.0/en/udf-compiling.html

I use the japanese Windows XP SP3 with japanese Visual Studio 2005 SP1.

In procedure 6, I tried to compile (& link) udf_sample.dll using this command.

devenv udf_example.sln /build Release

I got the error in japanese. It means 'stpcpy' function is undefined. Following 2-error(C2113) were caused by the error.

udf_example.c
.¥udf_example.c(639) : warning C4013: 関数 'stpcpy' は定義されていません。in
の値を返す外部関数と見なします。
.¥udf_example.c(775) : error C2113: '-' : ポインタ以外からポインタを減算する
はできません。
.¥udf_example.c(878) : error C2113: '-' : ポインタ以外からポインタを減算する
はできません。
ビルドログは "file://d:¥VS2005¥udf_example¥udf_example.dir¥Release¥BuildLog
に保存されました。
udf_example - エラー 2、警告 1
------ ビルドのスキップ: プロジェクト: ALL_BUILD, 構成: Release Win32 -----
プロジェクトはこのソリューション構成に対してビルドするように選択されていませ
========== ビルド: 0 正常終了、1 失敗、1 更新、1 スキップ ==========

How to repeat:
See Description.

Suggested fix:
In ordinary MS Windows environment, there is no 'stpcpy'. Then modify udf_sample.c source code to not using 'stpcpy'.

Or Add 'stpcpy' only when using MS Windows platform like this,

static char *stpcpy(char *dest, const char *src){strcpy(dest,src);return dest + strlen(dest);}

My workaround is that above static function definition add on line.143.