process to catch any implementation-discrepancies between symbols used
by the compiler and those implemented in the runtime.
The situation will happen from time to time and there is no need to
issue a panic when we can test sensibly for it.
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1394
d4fa192b-c00b-0410-8231-
f00ffab90ce4
#include <sys/types.h>
+#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int active;
};
-
static TAILQ_HEAD(, vclprog) vclhead = TAILQ_HEAD_INITIALIZER(vclhead);
/*--------------------------------------------------------------------*/
FILE *fo, *fs;
char *of, *sf, buf[BUFSIZ];
int i, j, sfd;
+ void *p;
/* Create temporary C source file */
sf = strdup("/tmp/vcl.XXXXXXXX");
of = NULL;
}
+ /* Next, try to load the object into the management process */
+ p = dlopen(of, RTLD_NOW | RTLD_LOCAL);
+ if (p == NULL) {
+ vsb_printf(sb, "Problem loading compiled VCL program:\n\t%s\n",
+ dlerror());
+ unlink(of);
+ free(of);
+ of = NULL;
+ } else
+ AZ(dlclose(p));
+
/* clean up and return */
unlink(sf);
free(sf);