Three dimensional coordiante transformation.
[gromacs.git] / cmake / TestVMD.cpp
blobc2bd74bd63d92a622d0a21e058173f162bbe3c63
1 #include "molfile_plugin.h"
2 #include "vmddlopen.cpp"
3 #include "stdio.h"
5 static int register_cb(void *v, vmdplugin_t *p) {
6 *(molfile_plugin_t**)v = (molfile_plugin_t *)p;
7 return VMDPLUGIN_SUCCESS;
10 typedef int (*initfunc)(void);
11 typedef int (*regfunc)(void *, vmdplugin_register_cb);
13 /*run: gcc TestVMD.cpp -DGMX_USE_PLUGINS -Wall -ldl -I../src/external/vmd_molfile -lm && ./a.out .../xyzplugin.so ; echo $?*/
14 int main(int argc, char** argv)
16 void *handle, *ifunc, *registerfunc;
17 molfile_plugin_t* api;
18 if (argc!=2) return -1;
19 handle = vmddlopen(argv[1]);
20 if (!handle)
22 fprintf(stderr,"%s\n",vmddlerror());
23 return 1;
25 ifunc = vmddlsym(handle, "vmdplugin_init");
26 if (!ifunc || ((initfunc)(ifunc))()) return 2;
27 registerfunc = vmddlsym(handle, "vmdplugin_register");
28 if (!registerfunc) return 3;
29 ((regfunc)registerfunc)(&api, register_cb);
30 if (!api) return 4;
31 if (api->abiversion<10) return 5;
32 return 0;