Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

usrAppInit calling function

403 views
Skip to first unread message

Paul Slocum

unread,
Jul 13, 2004, 4:42:13 PM7/13/04
to
I'm trying to call a function (defined in another file in the project)
from usrAppInit but the linker complains that it's an undefined
reference. The function I'm trying to call is definitely getting
compiled properly with the vxWorks image because if I boot vxWorks, I
have access to the function from the command prompt. Why isn't the
linker seeing it from usrAppInit?

-paul

John

unread,
Jul 13, 2004, 11:51:16 PM7/13/04
to
Hello,

I can think of a few things that you might have wrong:

a) The function is a C++ one (in which case its name will have been
mangled - usrAppInit is C and won't handle that, but the shell will).

b) Depending on the exact error you are getting, it could be that you
are missing the prototype for the function in the place where the
usrAppInit code is defined.

c) You have mistyped the name in usrAppInit (sounds silly, but I've
seen subtle typos leave people puzzled for hours)

As for solutions, well (a) can be solved using the extern "C" { ... }
wrapper around the function (or providing such a wrapper in the C++
code that calls your original routine). Solve (b) by making sure that
you include a prototype for the function you are calling in your code.
I will leave the solution for (c) as an exercise for the reader ;-)

HTH,
John...

=====
Contribute to the VxWorks Cookbook at: http://books.bluedonkey.org/

Paul Slocum

unread,
Jul 14, 2004, 6:41:43 PM7/14/04
to
> a) The function is a C++ one (in which case its name will have been
> mangled - usrAppInit is C and won't handle that, but the shell will).

That was it. Put in extern "C" and it cleared right up. Thanks!!! :o)

> c) You have mistyped the name in usrAppInit (sounds silly, but I've
> seen subtle typos leave people puzzled for hours)

Haha, yeah it happens.

-paul

0 new messages