From 3263a885a3f84f6ebf8b2de87d507da1cd9c2d87 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Sat, 2 Nov 1996 01:30:51 +0000 Subject: [PATCH] more pc related changes --- src/include/shareLib.h | 52 +++++++++++++++++++++++++++++++++++--- src/libCom/misc/shareLib.h | 52 +++++++++++++++++++++++++++++++++++--- 2 files changed, 96 insertions(+), 8 deletions(-) diff --git a/src/include/shareLib.h b/src/include/shareLib.h index 2c6390ffe..0d5001f80 100644 --- a/src/include/shareLib.h +++ b/src/include/shareLib.h @@ -1,18 +1,62 @@ - /* * Use compiler specific key words to set up shareable library * external symbols and entry points + * + * Right now this is only necessary for WIN32 DLL, + * the approach should be general enough for future systems, however. + * + * + * USAGE: + * + * In header files, declare variables, classes and functions + * to be __exported__ like this: + * + * epicsShareAPI int a_func (int arg); + * epicsShareExtern int a_var; + * class epicsShareClass a_class; + * + * Usually the epicsShare... macros expand to + * "import this from a DLL" (on WIN32, on Unix it's a NOP) + * + * In the implementation file, however, you write: + * + * #include + * #define epicsExportSharedSymbols + * #include + * ! no more "foreign" includes from here on ! + * + * The point is: define epicsExportSharedSymbols exacly and only + * right before you include the prototypes for what you implement! + * This time the epicsShare... macros expand to + * "export this from the DLL that we are building" (again only on WIN32) + * + * 8-22-96 -kuk- */ +#undef epicsShareExtern +#undef epicsShareClass +#undef epicsShareAPI + #ifdef WIN32 -# ifdef _WINDLL -# define epicsShareExtern __declspec(dllexport) + +# if defined(_WINDLL) || defined(epicsExportSharedSymbols) +# define epicsShareExtern __declspec(dllexport) extern +# define epicsShareClass __declspec(dllexport) # else # define epicsShareExtern __declspec(dllimport) extern +# define epicsShareClass __declspec(dllimport) # endif + /* + * Subroutine removes arguments + */ # define epicsShareAPI __stdcall + #else -# define epicsShareAPI + +/* no WIN32 -> no import/export specifiers */ + # define epicsShareExtern extern +# define epicsShareAPI +# define epicsShareClass #endif diff --git a/src/libCom/misc/shareLib.h b/src/libCom/misc/shareLib.h index 2c6390ffe..0d5001f80 100644 --- a/src/libCom/misc/shareLib.h +++ b/src/libCom/misc/shareLib.h @@ -1,18 +1,62 @@ - /* * Use compiler specific key words to set up shareable library * external symbols and entry points + * + * Right now this is only necessary for WIN32 DLL, + * the approach should be general enough for future systems, however. + * + * + * USAGE: + * + * In header files, declare variables, classes and functions + * to be __exported__ like this: + * + * epicsShareAPI int a_func (int arg); + * epicsShareExtern int a_var; + * class epicsShareClass a_class; + * + * Usually the epicsShare... macros expand to + * "import this from a DLL" (on WIN32, on Unix it's a NOP) + * + * In the implementation file, however, you write: + * + * #include + * #define epicsExportSharedSymbols + * #include + * ! no more "foreign" includes from here on ! + * + * The point is: define epicsExportSharedSymbols exacly and only + * right before you include the prototypes for what you implement! + * This time the epicsShare... macros expand to + * "export this from the DLL that we are building" (again only on WIN32) + * + * 8-22-96 -kuk- */ +#undef epicsShareExtern +#undef epicsShareClass +#undef epicsShareAPI + #ifdef WIN32 -# ifdef _WINDLL -# define epicsShareExtern __declspec(dllexport) + +# if defined(_WINDLL) || defined(epicsExportSharedSymbols) +# define epicsShareExtern __declspec(dllexport) extern +# define epicsShareClass __declspec(dllexport) # else # define epicsShareExtern __declspec(dllimport) extern +# define epicsShareClass __declspec(dllimport) # endif + /* + * Subroutine removes arguments + */ # define epicsShareAPI __stdcall + #else -# define epicsShareAPI + +/* no WIN32 -> no import/export specifiers */ + # define epicsShareExtern extern +# define epicsShareAPI +# define epicsShareClass #endif