Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

vmdplugin.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2003 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.22 $       $Date: 2006/03/09 18:53:41 $
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)) 
00063 #define WIN32_LEAN_AND_MEAN
00064 #include <windows.h>
00065 
00066 #if defined(VMDPLUGIN_EXPORTS)
00067 #if !defined(STATIC_PLUGIN)
00068 
00072 BOOL APIENTRY DllMain( HANDLE hModule,
00073                        DWORD ul_reason_for_call,
00074                        LPVOID lpReserved
00075                      )
00076 {
00077   return TRUE;
00078 }
00079 #endif
00080 
00081 #define VMDPLUGIN_API __declspec(dllexport)
00082 #else
00083 #define VMDPLUGIN_API __declspec(dllimport)
00084 #endif
00085 #else
00086 
00087 #define VMDPLUGIN_API 
00088 #endif
00089 
00091 #ifdef __cplusplus
00092 #define VMDPLUGIN_EXTERN extern "C" VMDPLUGIN_API
00093 #else
00094 #define VMDPLUGIN_EXTERN extern VMDPLUGIN_API
00095 #endif  /* __cplusplus */
00096 
00097 /* 
00098  * Plugin API functions start here 
00099  */
00100 
00101 
00107 VMDPLUGIN_EXTERN int VMDPLUGIN_init(void);
00108 
00122 #define vmdplugin_HEAD \
00123   int abiversion; \
00124   const char *type; \
00125   const char *name; \
00126   const char *prettyname; \
00127   const char *author; \
00128   int majorv; \
00129   int minorv; \
00130   int is_reentrant; 
00131 
00138 typedef struct {
00139   vmdplugin_HEAD
00140 } vmdplugin_t;
00141 
00145 #define vmdplugin_ABIVERSION   9
00146 
00149 #define VMDPLUGIN_THREADUNSAFE 0
00150 #define VMDPLUGIN_THREADSAFE   1
00151 
00155 #define VMDPLUGIN_SUCCESS      0
00156 #define VMDPLUGIN_ERROR       -1
00157 
00162 typedef int (*vmdplugin_register_cb)(void *, vmdplugin_t *);
00163 
00173 VMDPLUGIN_EXTERN int VMDPLUGIN_register(void *, vmdplugin_register_cb);
00174 
00180 VMDPLUGIN_EXTERN int VMDPLUGIN_register_tcl(void *, void *tcl_interp, 
00181     vmdplugin_register_cb);
00182 
00187 VMDPLUGIN_EXTERN int VMDPLUGIN_fini(void);
00188 
00189 #endif   /* VMD_PLUGIN_H */

Generated on Wed Mar 22 13:15:31 2006 for VMD Plugins (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002