2013-01-08 22:40:58 +08:00
|
|
|
/*
|
2021-03-08 18:19:04 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2013-01-08 22:40:58 +08:00
|
|
|
*
|
2018-08-30 20:27:45 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2013-01-08 22:40:58 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
2018-08-30 20:27:45 +08:00
|
|
|
* Date Author Notes
|
|
|
|
* 2010-11-17 yi.qiu first version
|
2013-01-08 22:40:58 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include <rtm.h>
|
|
|
|
|
2018-08-30 20:27:45 +08:00
|
|
|
#include "dlmodule.h"
|
|
|
|
|
2013-01-08 22:40:58 +08:00
|
|
|
void* dlsym(void *handle, const char* symbol)
|
|
|
|
{
|
2018-08-30 20:27:45 +08:00
|
|
|
int i;
|
|
|
|
struct rt_dlmodule *module;
|
2021-03-08 18:19:04 +08:00
|
|
|
|
2018-08-30 20:27:45 +08:00
|
|
|
RT_ASSERT(handle != RT_NULL);
|
2013-01-08 22:40:58 +08:00
|
|
|
|
2018-08-30 20:27:45 +08:00
|
|
|
module = (struct rt_dlmodule *)handle;
|
2013-01-08 22:40:58 +08:00
|
|
|
|
2018-08-30 20:27:45 +08:00
|
|
|
for(i=0; i<module->nsym; i++)
|
|
|
|
{
|
|
|
|
if (rt_strcmp(module->symtab[i].name, symbol) == 0)
|
|
|
|
return (void*)module->symtab[i].addr;
|
|
|
|
}
|
2013-01-08 22:40:58 +08:00
|
|
|
|
2018-08-30 20:27:45 +08:00
|
|
|
return RT_NULL;
|
2013-01-08 22:40:58 +08:00
|
|
|
}
|
|
|
|
RTM_EXPORT(dlsym)
|