00001 /* 00002 * Asterisk -- An open source telephony toolkit. 00003 * 00004 * Copyright (C) 1999 - 2005, Digium, Inc. 00005 * 00006 * See http://www.asterisk.org for more information about 00007 * the Asterisk project. Please do not directly contact 00008 * any of the maintainers of this project for assistance; 00009 * the project provides a web site, mailing lists and IRC 00010 * channels for your use. 00011 * 00012 * This program is free software, distributed under the terms of 00013 * the GNU General Public License Version 2. See the LICENSE file 00014 * at the top of the source tree. 00015 */ 00016 00017 /*! \file 00018 * \brief 00019 * Loader for Asterisk under Cygwin/windows. 00020 * Open the dll, locate main, run. 00021 */ 00022 00023 #include <unistd.h> 00024 #include <dlfcn.h> 00025 #include <stdio.h> 00026 00027 typedef int (*main_f)(int argc, char *argv[]); 00028 00029 int main(int argc, char *argv[]) 00030 { 00031 main_f ast_main = NULL; 00032 void *handle = dlopen("asterisk.dll", 0); 00033 if (handle) 00034 ast_main = (main_f)dlsym(handle, "main"); 00035 if (ast_main) 00036 return ast_main(argc, argv); 00037 fprintf(stderr, "could not load Asterisk, %s\n", dlerror()); 00038 return 1; /* there was an error */ 00039 }