1
1

Fix yet another linker error on OS X

This commit was SVN r655.
Этот коммит содержится в:
Jeff Squyres 2004-02-06 04:20:13 +00:00
родитель 8947cebc8d
Коммит 2748878e9f
3 изменённых файлов: 30 добавлений и 2 удалений

Просмотреть файл

@ -11,6 +11,7 @@
#include "mpi/group/group.h"
#include "mca/mpi/coll/coll.h"
struct lam_communicator_t {
char c_name[MPI_MAX_OBJECT_NAME];
uint32_t c_contextid;
@ -69,10 +70,12 @@ static inline lam_proc_t* lam_comm_lookup_peer(lam_communicator_t* comm, size_t
return comm->c_remote_group->g_procs[peer_id];
}
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
int lam_comm_init(lam_communicator_t *comm);
int lam_comm_link_function(void);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif

Просмотреть файл

@ -21,6 +21,18 @@ lam_communicator_t lam_mpi_comm_world;
lam_communicator_t lam_mpi_comm_self;
/*
* This function is here solely to allow non MPI progrlams be able to
* have the globals listed above linked in (e.g., laminfo). According
* to POSIX, we have to link in a function to guarantee that we can
* get the global symbols in the relevant .o file.
*/
int lam_comm_link_function(void)
{
return LAM_SUCCESS;
}
/*
* This is a shell function that needs to be filled in. It is here so
* that this file will get linked into MPI executables (POSIX says

Просмотреть файл

@ -19,6 +19,7 @@
#include "lam/runtime/runtime.h"
#include "lam/util/output.h"
#include "lam/util/cmd_line.h"
#include "mpi/communicator/communicator.h"
#include "mca/lam/base/base.h"
#include "tools/laminfo/laminfo.h"
@ -224,14 +225,15 @@ laminfo::type_vector_t laminfo::mca_types;
int main(int argc, char *argv[])
{
int ret;
int ret = 0;
bool acted = false;
bool want_all = false;
// Start LAM process
if (LAM_SUCCESS != lam_init(argc, argv))
if (LAM_SUCCESS != lam_init(argc, argv)) {
return -1;
}
// Initialize the argv parsing handle
@ -265,6 +267,17 @@ int main(int argc, char *argv[])
lam_cmd_line_make_opt(cmd_line, 'a', "all", 0,
"Show all configuration options and MCA parameters");
// Call some useless functions in order to guarantee to link in some
// global variables. Only check the return value so that the
// compiler doesn't optimize out the useless function.
if (LAM_SUCCESS != lam_comm_link_function()) {
// Stop .. or I'll say stop again!
++ret;
} else {
--ret;
}
// Get MCA parameters, if any */
mca_base_open();