[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

issues with undefined symbols.

From: Chris Bowlby
Subject: issues with undefined symbols.
Date: Thu, 13 Jan 2005 15:38:12 -0400

Hi All,

For the last few months I've been testing various capabilities of libtool and how it creates links between a parent application and a module (in the case of a plug-in system, etc). I've run into a snag in relation to undefined symbols, here's some sample code that gives me the error:


#include "testlog.hxx"
#include "testuser.hxx"

static TestLog *log = NULL;
static TestUser *user = NULL;

int main(int argc, char **argv) {
 log = new TestLog();
 user = new TestUser();

 void *lib_handle = NULL;
 void (*plugin_call)(int &);

 lib_handle = dlopen("", RTLD_NOW);
 if (!lib_handle) {

 plugin_call = (void (*)(int &))dlsym(lib_handle, "test_spawn");

 if (log != NULL) delete log;
 if (user != NULL) delete user;

the file is compile from a test.cxx with these details:


#include "testlog.hxx"
#include "testuser.hxx"

extern TestLog *log;
extern TestUser *user;

void test_spawn(int &testint) {
 if (testint > 2) {
  log->error("Invalid user");
 } else {

When I compile everything, it all compiles as it should, but when I attempt to execute the application I get the following error:

ERROR: Undefined symbol "user"

when I do an nm of the parent app I get:

0804def4 D _8TestUser$total_users_
0804def0 D _8TestUser$user_list_
0804de7c d user

Which tells me the main executable file has the data in place, and obviously the file does not:

         U user

I originally thought that name mangling was coming into place here, but if I strip out all "user" related class objects, the "log" related objects work perfectly fine. I can not see any difference between my user class and the log class objects that could be causing this to fail.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]