Using xilkernel with C++

Started by Guy Eschemann March 20, 2007
Hi,
is there a way to get the Xilkernel to run with a C++ application? I
didn't find any option for this in the XPS "Software Platform
Settings".
The problem I'm having is that my thread function ("TSK_Main", which
is declared in the C++ application) cannot be called from libxil.a,
which is a C library. This is the error message that I'm getting while
trying to build the C++ application:
../../ppc405_0_sw_platform/ppc405_0/lib/libxil.a(init.o):(.sdata+0x0):
undefined reference to `TSK_Main'
Maybe someone knows a workaround for this?
Many thanks,
Guy.

Guy Eschemann wrote:
> Hi, > is there a way to get the Xilkernel to run with a C++ application? I > didn't find any option for this in the XPS "Software Platform > Settings". > The problem I'm having is that my thread function ("TSK_Main", which > is declared in the C++ application) cannot be called from libxil.a, > which is a C library. This is the error message that I'm getting while > trying to build the C++ application: > ../../ppc405_0_sw_platform/ppc405_0/lib/libxil.a(init.o):(.sdata+0x0): > undefined reference to `TSK_Main' > Maybe someone knows a workaround for this?
This seems to be a linker problem. The naming conventions for c and c++ object files are different. You can declare C function in C++ with: extern "C" { ... TSK_Main(...); } or vice versa extern "C++" { ... TSK_Main(...); }
> Many thanks, > Guy. >
Thanks, Markus.
It is indeed a linker issue, which was solved using extern "C". Still,
I'm wondering if there are any other issues when using xilkernel with C
++?
Guy.

On Mar 21, 8:44 am, Markus <n...@nowhere.org> wrote:
> Guy Eschemann wrote: > > Hi, > > is there a way to get the Xilkernel to run with a C++ application? I > > didn't find any option for this in the XPS "Software Platform > > Settings". > > The problem I'm having is that my thread function ("TSK_Main", which > > is declared in the C++ application) cannot be called from libxil.a, > > which is a C library. This is the error message that I'm getting while > > trying to build the C++ application: > > ../../ppc405_0_sw_platform/ppc405_0/lib/libxil.a(init.o):(.sdata+0x0): > > undefined reference to `TSK_Main' > > Maybe someone knows a workaround for this? > > This seems to be a linker problem. The naming conventions for c and c++ > object files are different. You can declare C function in C++ with: > > extern "C" { > ... TSK_Main(...); > > } > > or vice versa > > extern "C++" { > ... TSK_Main(...); > > } > > Many thanks, > > Guy.