|
我用Tornado2.2(vxworks5.5),在虚拟机上建立文件系统FAT16格式,通过ftp从windows向目标机vxworks传递应用模块api.o,文件 可以用ls查看到,在目标机sell上运行ld(1,0,"C:/api.o"),报错"error loading,errno=0x3d0001".该文件在Tornado用target server加载可以成功运行.
api.c内容如下
#include
#include
void test()
{
pritf("welcome!");
}
然后工程中添加ldtest.c,内容主要如下
/* 打开第一个可执行文件位于ram0 */
fd = open("ram0/myapp.out", O_RDONLY, 0);
if(fd == ERROR) {
printf("Can not open application program file. \n\r") ;
return(ERROR);
} else {
printf("Application program file opened. \n\r") ;
}
/* 加载模块 */
printf("Autoload application model...\n");
if((hModule = loadModule(fd, LOAD_ALL_SYMBOLS)) == NULL) {
close(fd);
printf("LoadModule for application is error = 0x%x. \n\r", errno);
return(ERROR);
}
close(fd);
文件打开不报错,但在loadModule中报错,用errno为S_objLib_OBJ_ID_ERROR,查看源码在/target/h/objLib.h中代码
#define OBJ_VERIFY(objId,classId) \
( \
( \
(((OBJ_ID)(objId))->pObjClass == (struct obj_class *)(classId)) || \
( \
((OBJ_ID)(objId))->pObjClass && \
(((OBJ_ID)(objId))->pObjClass == \
(CLASS_ID)(((struct obj_class *)(classId))->initRtn)) \
) \
) \
? \
OK \
: \
(errno = S_objLib_OBJ_ID_ERROR, ERROR) \
经过我测试发现错出在(((OBJ_ID)(objId))->pObjClass == \
(CLASS_ID)(((struct obj_class *)(classId))->initRtn)) 上,这一行代码看不懂.
谁能指导我一下可能错出在那一方面上?怎么解决?不胜感激.
|
|