From 66aa22f9eb088da40ed8750dfec06b3c2c28a715 Mon Sep 17 00:00:00 2001 From: Ken Evans Date: Fri, 20 Feb 1998 21:48:33 +0000 Subject: [PATCH] Added epicsShareAPIV for variable args functions. These cannot be _stdcall, so the current implementation was not working. epicsShareAPIV should be used for functions with both ... and va_list type arguments. --- src/include/shareLib.h | 19 +++++++++++++++++-- src/libCom/misc/shareLib.h | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/include/shareLib.h b/src/include/shareLib.h index 65bb03108..fa5a093cf 100644 --- a/src/include/shareLib.h +++ b/src/include/shareLib.h @@ -13,8 +13,14 @@ * * epicsShareFunc int epicsShareAPI * a_func (int arg); function prototype - * epicsShareExtern int a_var; reference variable - * epicsShareDef int a_var= 4; create variable instance + * or + * epicsShareFunc int epicsShareAPIV + * a_func (int arg, ...); variable args function prototype + * (using either ... or va_list) + * epicsShareExtern int a_var; reference variable + * (reference declaration) + * epicsShareDef int a_var= 4; create variable instance + * (definition declaration) * class epicsShareClass a_class; reference a class * * Usually the epicsShare... macros expand to @@ -42,6 +48,7 @@ #undef epicsShareClass #undef epicsShareFunc #undef epicsShareAPI +#undef epicsShareAPIV #undef READONLY #if defined(_WIN32) @@ -61,6 +68,12 @@ * __declspec(xxxx)) */ # define epicsShareAPI __stdcall + /* + * Variable args functions cannot be __stdcall + * Use this for variable args functions + * (Those using either ... or va_list arguments) + */ +# define epicsShareAPIV __cdecl # define epicsShareDef __declspec(dllexport) # define READONLY const @@ -82,6 +95,7 @@ # define epicsShareClass # define epicsShareFunc # define epicsShareAPI +# define epicsShareAPIV #else @@ -89,6 +103,7 @@ # define epicsShareExtern extern # define epicsShareAPI +# define epicsShareAPIV # define epicsShareClass # define epicsShareDef diff --git a/src/libCom/misc/shareLib.h b/src/libCom/misc/shareLib.h index 65bb03108..fa5a093cf 100644 --- a/src/libCom/misc/shareLib.h +++ b/src/libCom/misc/shareLib.h @@ -13,8 +13,14 @@ * * epicsShareFunc int epicsShareAPI * a_func (int arg); function prototype - * epicsShareExtern int a_var; reference variable - * epicsShareDef int a_var= 4; create variable instance + * or + * epicsShareFunc int epicsShareAPIV + * a_func (int arg, ...); variable args function prototype + * (using either ... or va_list) + * epicsShareExtern int a_var; reference variable + * (reference declaration) + * epicsShareDef int a_var= 4; create variable instance + * (definition declaration) * class epicsShareClass a_class; reference a class * * Usually the epicsShare... macros expand to @@ -42,6 +48,7 @@ #undef epicsShareClass #undef epicsShareFunc #undef epicsShareAPI +#undef epicsShareAPIV #undef READONLY #if defined(_WIN32) @@ -61,6 +68,12 @@ * __declspec(xxxx)) */ # define epicsShareAPI __stdcall + /* + * Variable args functions cannot be __stdcall + * Use this for variable args functions + * (Those using either ... or va_list arguments) + */ +# define epicsShareAPIV __cdecl # define epicsShareDef __declspec(dllexport) # define READONLY const @@ -82,6 +95,7 @@ # define epicsShareClass # define epicsShareFunc # define epicsShareAPI +# define epicsShareAPIV #else @@ -89,6 +103,7 @@ # define epicsShareExtern extern # define epicsShareAPI +# define epicsShareAPIV # define epicsShareClass # define epicsShareDef