diff options
-rw-r--r-- | main/cygload.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/main/cygload.c b/main/cygload.c new file mode 100644 index 000000000..fc9c1c2f8 --- /dev/null +++ b/main/cygload.c @@ -0,0 +1,20 @@ +/* + * Loader for asterisk under windows. + * Open the dll, locate main, run. + */ +#include <unistd.h> +#include <dlfcn.h> +#include <stdio.h> + +typedef int (*main_f)(int argc, char *argv[]); + +int main(int argc, char *argv[]) +{ + main_f ast_main = NULL; + void *handle = dlopen("asterisk.dll", 0); + if (handle) + ast_main = (main_f)dlsym(handle, "amain"); + if (ast_main) + return ast_main(argc, argv); + fprintf(stderr, "could not load asterisk, %s\n", dlerror()); +} |