22 #ifdef __PLUMED_HAS_DLOPEN
43 void(*cmd)(
void*,
const char*,
const void*);
44 void(*finalize)(
void*);
52 #ifdef __PLUMED_STATIC_KERNEL
72 #ifdef __PLUMED_STATIC_KERNEL
90 fprintf(stderr,
"+++ ERROR: you are trying to use plumed, but it is not available +++\n");
91 fprintf(stderr,
"+++ Check your PLUMED_KERNEL environment variable +++\n");
102 #ifdef __PLUMED_STATIC_KERNEL
122 #ifdef __PLUMED_HAS_DLOPEN
125 if(first && f==NULL){
126 path=getenv(
"PLUMED_KERNEL");
128 fprintf(stderr,
"+++ Loading the PLUMED kernel runtime +++\n");
129 fprintf(stderr,
"+++ PLUMED_KERNEL=\"%s\" +++\n",path);
130 p=dlopen(path,RTLD_NOW|RTLD_GLOBAL);
132 fprintf(stderr,
"+++ PLUMED kernel successfully loaded +++\n");
135 fprintf(stderr,
"+++ PLUMED kernel not found ! +++\n");
136 fprintf(stderr,
"+++ error message from dlopen(): %s\n",dlerror());
177 assert(gmain.
p==NULL);
191 if(gmain.
p)
return 1;
203 assert(CHAR_BIT<=12);
204 assert(
sizeof(p.
p)<=16);
207 cc=(
unsigned char*)&p.
p;
208 for(i=0;i<
sizeof(p.
p);i++){
213 c[2*i+1]=cc[i]%64+48;
222 assert(CHAR_BIT<=12);
223 assert(
sizeof(p.
p)<=16);
226 cc=(
unsigned char*)&p.
p;
227 for(i=0;i<
sizeof(p.
p);i++){
231 cc[i]=(c[2*i]-48)*64 + (c[2*i+1]-48);
301 #define IMPLEMENT(lower,upper,implem) \
302 void lower ##_ implem \
303 void lower ##__ implem \
305 void upper ##_ implem \
306 void upper ##__ implem
plumed plumed_global(void)
Retrieves an handler to the global structure.
plumed_plumedmain_function_holder * plumed_kernel_register(const plumed_plumedmain_function_holder *)
Register for plumedmain function pointers.
int plumed_ginitialized(void)
Check if the global interface has been initialized.
plumed plumed_f2c(const char *c)
Converts a FORTRAN handler to a C handler.
void plumed_f_finalize(char *c)
int plumed_installed(void)
Check if plumed is installed (for runtime binding)
void plumed_f_gcreate(void)
void plumed_f_cmd(char *c, char *key, void *val)
void plumed_f_create(char *c)
void plumed_f_ginitialized(int *i)
#define IMPLEMENT(lower, upper, implem)
Container for plumedmain function pointers (create, cmd and finalize).
void * plumed_dummy_create(void)
void plumed_f_gfinalize(void)
void plumedmain_finalize(void *plumed)
void * p
Void pointer holding the real PlumedMain structure.
void plumedmain_cmd(void *plumed, const char *key, const void *val)
void plumed_cmd(plumed p, const char *key, const void *val)
Tells p to execute a command.
void plumed_f_installed(int *i)
void plumed_dummy_cmd(void *, const char *, const void *)
void plumed_c2f(plumed p, char *c)
Converts a C handler to a FORTRAN handler.
void plumed_dummy_finalize(void *)
plumed plumed_create(void)
Constructor.
void * plumedmain_create()
void plumed_f_gcmd(char *key, void *val)
void plumed_gcmd(const char *key, const void *val)
Tells to the global interface to execute a command.
void(* cmd)(void *, const char *, const void *)
void plumed_gfinalize(void)
Destructor for the global interface.
void plumed_finalize(plumed p)
Destructor.
void plumed_gcreate(void)
Constructor for the global interface.
void plumed_f_global(char *c)