aboutsummaryrefslogtreecommitdiffstats
path: root/cygwin
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-11-01 21:53:30 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-11-01 21:53:30 +0000
commit4d4023555b8c4e5812d2ac67242fe7754acc6def (patch)
tree17036a33b500972a312f1a5b2c75bee313f4b4d1 /cygwin
parenta68250b79bf5358b7cf67bbd9185409a17993abc (diff)
issue #4678
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6936 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cygwin')
-rwxr-xr-xcygwin/Makefile6
-rwxr-xr-xcygwin/cygloader.c33
2 files changed, 39 insertions, 0 deletions
diff --git a/cygwin/Makefile b/cygwin/Makefile
new file mode 100755
index 000000000..124628f9c
--- /dev/null
+++ b/cygwin/Makefile
@@ -0,0 +1,6 @@
+OBJS=cygloader.o
+all: $(OBJS)
+$(OBJS) : %.o: %.c
+ $(CC) $< -o asterisk.exe
+clean:
+ rm -f asterisk.exe
diff --git a/cygwin/cygloader.c b/cygwin/cygloader.c
new file mode 100755
index 000000000..0d48c0f6c
--- /dev/null
+++ b/cygwin/cygloader.c
@@ -0,0 +1,33 @@
+#include <unistd.h>
+#include <dlfcn.h>
+#include <stdio.h>
+
+#define OK 0
+#define MODULE_NOT_FOUND 1
+#define INVALID_NUMBER_ARGUMENTS 2
+
+int main(int argc, char **argv) {
+ /* Asterisk entry point */
+ char* error = NULL;
+ int (*ast_main)(int argc, char **argv);
+
+ void *handle = dlopen ("asterisk.dll", RTLD_GLOBAL);
+ if (handle == NULL) {
+ fputs (dlerror(), stderr);
+ fputs ("\r\n", stderr);
+ return MODULE_NOT_FOUND;
+ }
+ printf("\r\nAsterisk module loaded successfully");
+ ast_main = dlsym(handle, "main");
+ if ((error = dlerror()) != NULL) {
+ fputs("Asterisk main not found", stderr);
+ fputs(error, stderr);
+ exit(1);
+ }
+ printf("\r\nAsterisk entry point found");
+ /* run asterisk main */
+ (*ast_main)(argc, argv);
+ dlclose(handle);
+ printf("\r\nAsterisk stopped");
+ return OK;
+}