libtool
[Top][All Lists]
Advanced

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

ld.so.1: dlopen: fatal: foo: can't find symbol


From: Christopher Lintz
Subject: ld.so.1: dlopen: fatal: foo: can't find symbol
Date: Mon, 16 Apr 2001 15:46:06 -0600

I would greatly appreciate any help that will get me past this problem.  I have tried Libtool
and gcc directly on Solaris 2.6 to try and build a shared library that can be called by
dlopen()...  This is the exact error I get:
 
ld.so.1: dlopen: fatal: foo: can't find symbol
 
Here is the exact command I use to build the shared object and the main program that
does the dlopen():
 
libtool gcc -g -O -c foo.cpp
libtool gcc -module -g -O -o foo.lo -rpath /home/cjl/libs
gcc -g -o -c main.cpp
gcc -o main main.o -ldl
 
**********Here is my exact main.cpp************
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
 
int main()
{    
   void *handle;
   int (*fptr)();
   char* error;
 
   handle = dlopen("/home/cjl/.libs/foo.so.0", RTLD_LAZY );
   if(!handle)
   {
      fputs( dlerror(), stderr);
      exit( -1 );
   }
 
   if ((fptr = (int (*) () )dlsym(RTLD_DEFAULT, "foo")) != NULL)
        (*fptr)();
   else
   if( (error = dlerror()) != NULL)
   {
      fputs(error, stderr);
      exit(-1);
   }
   dlclose(handle);
}
********************************
 
**************Here is my exact foo.cpp**************
#include "GCC001.h"
 
int foo()
{
  return 0;
}

************************************************************
 
I have tried the libtool on two different machines (1 with more recent Solaris patches).  I
even tried the -export-dymanic linked with the main.cpp.  Why would I be unable to find
the symbol associated with foo after all of this??
 
Thanks for your help....
 
chris
 

 

reply via email to

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