I call loadModule as follows:
if((id = loadModule(fd,LOAD_ALL_SYMBOLS)) == 0)
{
printErr("Error loading module\n");
return(ERROR);
}
err = errnoGet();
Then:
if(symFindByName(sysSymTbl, "kim_test", (char**)&symbolAddr,
&symType) != OK) {
printf("USRAPPINIT:Error finding symbol kim_test");
printf("errno = %x",errnoGet());
}else {
taskSpawn("kim_test", 100, 0, 0x200, symbolAddr, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0);
}
I am getting an erro of symbol not found.
When i execute a lkup form the target the symbol is found. My question
is why is the call falling in the code?
I have executed this from a downloadable object, as well as form
usrAppIinit() with the same results.
Kim
>I call loadModule as follows:
> if((id = loadModule(fd,LOAD_ALL_SYMBOLS)) == 0)
> if(symFindByName(sysSymTbl, "kim_test", (char**)&symbolAddr,
>&symType) != OK) {
> printf("USRAPPINIT:Error finding symbol kim_test");
>I am getting an erro of symbol not found.
>
>When i execute a lkup form the target the symbol is found. My question
>is why is the call falling in the code?
>
>I have executed this from a downloadable object, as well as form
>usrAppIinit() with the same results.
From symlib reference:
-----------snip!-----------------
The target server uses only one symbol table. This table is accessed through
the global variable tgtSymTbl, which is of the type SYMTAB_ID.
-----------snip!-----------------
From loadlib reference
-----------snip!-----------------
ADDING SYMBOLS TO THE SYMBOL TABLE
The symbols defined in the module being loaded may optionally be added to
the target server symbol table, depending on the value of loadFlag:
-----------snip!-----------------
Hmm, how bizarre, why would it insist on loading it's symbols to the
target server? What if there isn't a target server....
OMG !!! There are *TWO* load libs !!!
There is "loadLib" and "loadlib". The first one (with capital L on Lib)
is in the "VxWorks Reference Manual : Libraries", and the other is in the
"Tornado API Reference : Target Server Internal Routines".
And guess what !! They *both* have functions called loadModule !
-----------snip!-----------------
loadModule( )
NAME
loadModule( ) - load an object module into memory
SYNOPSIS
MODULE_ID loadModule
(
int fd, /* fd of file to load */
int loadFlag /* control of loader's behavior */
)
DESCRIPTION
This routine loads an object module from the specified file and places the
text, data, and bss segments into memory allocated from the target memory
pool.
-----------snip!-----------------
-----------snip!-----------------
loadModule( )
NAME
loadModule( ) - load an object module into memory
SYNOPSIS
MODULE_ID loadModule
(
int fd, /* fd of file to load */
int symFlag /* symbols to add to table (LOAD_[NO | LOCAL | GLOBAL | */
)
DESCRIPTION
This routine loads an object module from the specified file, and places the
code, data, and BSS into memory allocated from the system memory pool.
This call is equivalent to loadModuleAt( ) with NULL for the addresses of
text, data, and BSS segments. For more details, see the manual entry for
loadModuleAt( ).
-----------snip!-----------------
So I'll just *bet* you're not calling the one you expect, and there's a
confusion between the two different sets of flag values that they
understand.
hth,
DaveK
--
They laughed at Galileo. They laughed at Copernicus. They laughed at
Columbus. But remember, they also laughed at Bozo the Clown.
I checked out the references,,,,,doesn't the target server run on the
host, hence I would not use the reference form loadlib.h
I am using loadLib.h, the modules are loading, and I do see the symbol
when I run lkup from the target,.So I am assuming, from what I have
read, that the symbol is in the symbol table.
I just don't get why the symbols are not reachable via the code? Is it
because I downloaded it from the host?
K
>
> I just don't get why the symbols are not reachable via the code? Is it
> because I downloaded it from the host?
>
> K
If you load the module via the host target server, the target symbol table
won't be updated unless you have the option selected to sync the target
and host symbol tables. I think its a BSP option as well as a target
server option.
Use the windsh command
@lkup "symbol"
to see if the symbols are resident in the target symbol table.
Another option would be to load the modules on the target. You could use
the target server filesystem for that.
Regards,
Pete
--
+-----------------------------------------------------------------+
| Pete Kockritz mailto:pkoc...@home.com |
| This space for rent. |
+-----------------------------------------------------------------+
I get the same behavior.
When i execute lkup "symbol" I do see the symbol.
If i use the following execute("symbol"), then the function related to
symbol does in fact execute from the code?
K
On Sat, 17 Feb 2001 04:03:32 GMT, pkoc...@home.com (Pete Kockritz)
wrote:
OK, that stifles my theory about using the wrong definition of
LOAD_ALL_SYMBOLS when calling loadModule.
>I get the same behavior.
>
>When i execute lkup "symbol" I do see the symbol.
>
>If i use the following execute("symbol"), then the function related to
>symbol does in fact execute from the code?
Is the symbol in question extern "C" ? If not, should you be trying to
look up a mangled version of its name? Is it only working in the target
shell with 'lkup' because it looks up anything that begins with the string
you supply, and then demangles it before printing it out, whereas the
symFindByName function expects to be passed an entire name?