dlsym.c 736 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * File : dlsym.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* dlsym(void *handle, const char* symbol)
  17. {
  18. int i;
  19. rt_module_t module;
  20. RT_ASSERT(handle != RT_NULL);
  21. module = (rt_module_t)handle;
  22. for(i=0; i<module->nsym; i++)
  23. {
  24. if (rt_strcmp(module->symtab[i].name, symbol) == 0)
  25. return (void*)module->symtab[i].addr;
  26. }
  27. return RT_NULL;
  28. }
  29. RTM_EXPORT(dlsym)