Merged revisions 116463 via svnmerge from
[asterisk-bristuff.git] / main / cygload.c
blobfd8f3d5b6c7a5c36033724046f721319f11e81a5
1 /*
2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2005, Digium, Inc.
6 * See http://www.asterisk.org for more information about
7 * the Asterisk project. Please do not directly contact
8 * any of the maintainers of this project for assistance;
9 * the project provides a web site, mailing lists and IRC
10 * channels for your use.
12 * This program is free software, distributed under the terms of
13 * the GNU General Public License Version 2. See the LICENSE file
14 * at the top of the source tree.
17 /*! \file
18 * \brief
19 * Loader for Asterisk under Cygwin/windows.
20 * Open the dll, locate main, run.
23 #include <unistd.h>
24 #include <dlfcn.h>
25 #include <stdio.h>
27 typedef int (*main_f)(int argc, char *argv[]);
29 int main(int argc, char *argv[])
31 main_f ast_main = NULL;
32 void *handle = dlopen("asterisk.dll", 0);
33 if (handle)
34 ast_main = (main_f)dlsym(handle, "main");
35 if (ast_main)
36 return ast_main(argc, argv);
37 fprintf(stderr, "could not load Asterisk, %s\n", dlerror());
38 return 1; /* there was an error */