Asterisk - The Open Source Telephony Project GIT-master-7e7a603
cygload.c
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 1999 - 2005, Digium, Inc.
5 *
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.
11 *
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.
15 */
16
17/*! \file
18 * \brief
19 * Loader for Asterisk under Cygwin/windows.
20 * Open the dll, locate main, run.
21 */
22
23#include <unistd.h>
24#include <dlfcn.h>
25#include <stdio.h>
26
27typedef int (*main_f)(int argc, char *argv[]);
28
29int main(int argc, char *argv[])
30{
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 */
39}
int main(int argc, char *argv[])
Definition: cygload.c:29
int(* main_f)(int argc, char *argv[])
Definition: cygload.c:27
#define NULL
Definition: resample.c:96