Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

vmdplugin.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2006 The Board of Trustees of the
00004  *cr                        University of Illinois
00005  *cr                         All Rights Reserved
00006  *cr
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: vmdplugin.h,v $
00013  *      $Author: johns $       $Locker:  $             $State: Exp $
00014  *      $Revision: 1.35 $       $Date: 2020/10/16 07:50:56 $
00015  *
00016  ***************************************************************************/
00017 
00023 #ifndef VMD_PLUGIN_H
00024 #define VMD_PLUGIN_H
00025 
00026 
00027 /* 
00028  * Preprocessor tricks to make it easier for us to redefine the names of
00029  * functions when building static plugins.
00030  */
00031 #if !defined(VMDPLUGIN)
00032 
00036 #define VMDPLUGIN vmdplugin
00037 #endif
00038 
00039 #define xcat(x, y) cat(x, y)
00040 
00041 #define cat(x, y) x ## y 
00042 
00043 /*
00044  *  macros to correctly define plugin function names depending on whether 
00045  *  the plugin is being compiled for static linkage or dynamic loading. 
00046  *  When compiled for static linkage, each plugin needs to have unique
00047  *  function names for all of its entry points.  When compiled for dynamic
00048  *  loading, the plugins must name their entry points consistently so that
00049  *  the plugin loading mechanism can find the register, register_tcl, init,
00050  *  and fini routines via dlopen() or similar operating system interfaces.
00051  */
00054 #define VMDPLUGIN_register     xcat(VMDPLUGIN, _register)
00055 #define VMDPLUGIN_register_tcl xcat(VMDPLUGIN, _register_tcl)
00056 #define VMDPLUGIN_init         xcat(VMDPLUGIN, _init)
00057 #define VMDPLUGIN_fini         xcat(VMDPLUGIN, _fini)
00058 
00062 #if (defined(WIN32) || defined(WIN64) || defined(_MSC_VER)) 
00063 #define WIN32_LEAN_AND_MEAN
00064 #include <windows.h>
00065 
00066 #if !defined(STATIC_PLUGIN)
00067 #if defined(VMDPLUGIN_EXPORTS)
00068 
00072 BOOL APIENTRY DllMain( HANDLE hModule,
00073                        DWORD ul_reason_for_call,
00074                        LPVOID lpReserved
00075                      )
00076 {
00077   return TRUE;
00078 }
00079 
00080 #define VMDPLUGIN_API __declspec(dllexport)
00081 #else
00082 #define VMDPLUGIN_API __declspec(dllimport)
00083 #endif /* VMDPLUGIN_EXPORTS */
00084 #else  /* ! STATIC_PLUGIN */
00085 #define VMDPLUGIN_API
00086 #endif /* ! STATIC_PLUGIN */
00087 #else
00088 
00089 #define VMDPLUGIN_API 
00090 #endif
00091 
00093 #ifdef __cplusplus
00094 #define VMDPLUGIN_EXTERN extern "C" VMDPLUGIN_API
00095 #else
00096 #define VMDPLUGIN_EXTERN extern VMDPLUGIN_API
00097 #endif  /* __cplusplus */
00098 
00099 /* 
00100  * Plugin API functions start here 
00101  */
00102 
00103 
00109 VMDPLUGIN_EXTERN int VMDPLUGIN_init(void);
00110 
00124 #define vmdplugin_HEAD \
00125   int abiversion; \
00126   const char *type; \
00127   const char *name; \
00128   const char *prettyname; \
00129   const char *author; \
00130   int majorv; \
00131   int minorv; \
00132   int is_reentrant; 
00133 
00140 typedef struct {
00141   vmdplugin_HEAD
00142 } vmdplugin_t;
00143 
00147 #define vmdplugin_ABIVERSION  18
00148 
00151 #define VMDPLUGIN_THREADUNSAFE 0
00152 #define VMDPLUGIN_THREADSAFE   1
00153 
00157 #define VMDPLUGIN_SUCCESS      0
00158 #define VMDPLUGIN_ERROR       -1
00159 
00164 typedef int (*vmdplugin_register_cb)(void *, vmdplugin_t *);
00165 
00175 VMDPLUGIN_EXTERN int VMDPLUGIN_register(void *, vmdplugin_register_cb);
00176 
00182 VMDPLUGIN_EXTERN int VMDPLUGIN_register_tcl(void *, void *tcl_interp, 
00183     vmdplugin_register_cb);
00184 
00189 VMDPLUGIN_EXTERN int VMDPLUGIN_fini(void);
00190 
00191 #endif   /* VMD_PLUGIN_H */

Generated on Tue Oct 8 03:09:54 2024 for VMD Plugins (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002