dlopen.c 765 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * File : dlopen.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2010-11-17 yi.qiu first version
  13. */
  14. #include <rtthread.h>
  15. #include <rtm.h>
  16. void* dlopen(const char *filename, int flags)
  17. {
  18. rt_module_t module;
  19. RT_ASSERT(filename != RT_NULL);
  20. /* find in module list */
  21. module = rt_module_find(filename);
  22. if(module)
  23. {
  24. module->nref++;
  25. return (void*)module;
  26. }
  27. else
  28. {
  29. module = rt_module_open(filename);
  30. }
  31. }
  32. RTM_EXPORT(dlopen)