dlsym.c 767 B

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