cygload.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. /*! \file
  17. * \brief
  18. * Loader for Asterisk under Cygwin/windows.
  19. * Open the dll, locate main, run.
  20. */
  21. #include <unistd.h>
  22. #include <dlfcn.h>
  23. #include <stdio.h>
  24. typedef int (*main_f)(int argc, char *argv[]);
  25. int main(int argc, char *argv[])
  26. {
  27. main_f ast_main = NULL;
  28. void *handle = dlopen("asterisk.dll", 0);
  29. if (handle)
  30. ast_main = (main_f)dlsym(handle, "main");
  31. if (ast_main)
  32. return ast_main(argc, argv);
  33. fprintf(stderr, "could not load Asterisk, %s\n", dlerror());
  34. return 1; /* there was an error */
  35. }