I can't belive we didn't do this in the first place. Thanks!
I'll incorporate this and get a new release out shortly.
Paul Hargrove also sent in some fixes that I'll try to include in there as
well.
On 9/18/06 7:07 PM, "Emmanuel Paris" <emmanuel.paris_at_[hidden]>
wrote:
> Hi,
>
> I got these errors when linking my C++ objects with the libplpa :
>
> g++ -L/usr/local/lib -L/usr/local/xerces/lib -L/usr/lib/mysql -o xxxx
> xxxx.o yyyyy.o daemon.o -lxxxx -lxerces-c -lmysqlclient_r -lz -lsnmp
> -lplpa -lc
> daemon.o(.text+0xfea): In function `CDaemon::BindToCpu(int)':
> daemon.cpp:108: undefined reference to `plpa_api_probe()'
> daemon.o(.text+0x1040):daemon.cpp:113: undefined reference to
> `plpa_sched_setaffinity(int, unsigned int, plpa_cpu_set_t const*)'
> collect2: ld returned 1 exit status
>
>
> That is due to the fact that in C++, the function's return type and
> parameters types are
> used to name the symbols:
>
> shell> nm -A daemon.o | grep plpa
> daemon.o: U _Z14plpa_api_probev
> daemon.o: U _Z22plpa_sched_setaffinityijPK14plpa_cpu_set_t
>
> So the solution is to enclosed the plpa functions definitions in the header
> by extern "C" { }
> compilation directive. The cleanest way to do it should be to modifiy the
> file plpa.h :
>
> #ifdef __cplusplus
> extern "C" {
> #include "plpa_bottom.h"
> }
> #else
> #include "plpa_bottom.h"
> #endif
>
> In patch format :
>
> *** plpa.h.in 2006-02-17 14:39:24.000000000 +0100
> --- plpa.h.in.patch 2006-09-18 19:04:20.000000000 +0200
> ***************
> *** 72,77 ****
> --- 72,84 ----
> #undef STDC_HEADERS
>
>
> + #ifdef __cplusplus
> + extern "C" {
> #include "plpa_bottom.h"
> + }
> + #else
> + #include "plpa_bottom.h"
> + #endif
> +
> #endif /* PLPA_H */
>
>
> ...
>
> Regards,
>
> Emmanuel
> _______________________________________________
> plpa-users mailing list
> plpa-users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/plpa-users
--
Jeff Squyres
Server Virtualization Business Unit
Cisco Systems
|