繁体中文
高级搜索
 
首页 | 电子技术应用 | 行业最新动态 | 行业最新产品 | 软件资料下载 | 电路图纸欣赏 | 博客文章精选 | 电子精品论坛 | 电子技术贴吧

当前位置:首页 >> 博客文章精选 >> 嵌入式系统-博客 >> VxWorks系统函数loadModule()程序示例
VxWorks系统函数loadModule()程序示例
作者:   来源: 发表时间:2006-12-08  字号:  
VxWorks系统函数loadModule()程序示例

loadModule()
VxWorks中用来加载.o.out文件,然后用moduleFindByName()来找到符号表中固定入口函数所在的位置。
可以参考usrLib.hmoduleLib.h来获得详细信息。



#include
#include
#include
#include
#include
#include
#include
#include


extern SYMTAB_ID sysSymTbl ;

int loadTestModuleAndRun()
{
int fd = ERRor ;
int status = ERRor ;
MODULE_ID hModule ;
FUNCPTR taskEntry = NULL ;
SYM_TYPE * pType ;

fd = open("/sd0/test.out",O_RDONLY,0) ;

if (fd==ERROR)
{
printf("can not open binary file.\n") ;
return ERRor ;
}
else
{
printf("binary file opened.\n") ;
}

if ((hModule="loadModule"(fd,LOAD_ALL_SYMBOLS))==NULL)
{
printf("loadModule error = 0x%x.\n",errno) ;
return ERROR;
}

close(fd) ;

status = symFindByName(sysSymTbl,"test",
(char **)&taskEntry,pType ) ;

if (status==ERROR)
{
printf("symFindByName error=%d\n", errno) ;
return ERROR;
}
else
{
/* Type N_ABS="2",N_TEXT="4",N_DATA="6",N_BSS="8";N_EXT="1" */

printf("taskEntryr="0x"%x, type=%d\n.",
(int)taskEntry,(int)*pType);
}

status = taskSpawn("test",100,0,30000,taskEntry,
     0,0,0,0,0,0,0,0,0,0) ;

if (status==ERROR)
{
printf("taskSpawn error=%d\n",errno) ;
return ERROR;
}

return OK ;
}


!注意:如果您发现此文章出现影响您的阅读的状况,请从浏览器地址栏里复制本文的链接到留言本报告给站长解决!
  • 上一篇: vxworks中断
  • 下一篇: 为arm,51与优盘进行串口通信的东东

  • >> 联系我们请给我们留言·留言本
    本站所有提供的信息软件资料均来自网络,版权及著作权归原作者所有,如果无意中侵犯了您的相关权利或触及法律法规,请给我们留言, 我们将在24小时内删除。
      浙ICP备05071687号  电子技术精品网