Re: Need help with loading .SO file



Tobias Hippler wrote:
Otherwise the symbols of your *.so get mangled (c++ - style) and the
runtime loader can't find the symbol "Proc_Init".
BTW if you don't have to use C++, you can simply rename your file to
"Proc.c". This way the C compiler is used and no name mangling occurrs.

Strictly, the C compiler does name mangling too, but the mangling it
does is really very simple; it just puts an underline in front. In the
case of C++ though, things are more horrible since the type of the
function is encoded in the mangled name and IIRC not all compilers use
the same method for doing this. This is why Tcl doesn't try to figure
it out, and since C linkage is perfectly adequate for this and has to
be supported by the compiler anyway, there's no incentive to change.
:-)

Donal.

.



Relevant Pages

  • Re: Fortran 90 modules suck for portability- why use them?
    ... it is clear that I am talking about name mangling. ... of the various flags gfortran has for name mangling; PathScale has the ... name mangling was perhaps inherited from g95 (the other OSS compiler) ...
    (comp.lang.fortran)
  • Re: extern "C" ... again
    ... There is no standard or convention on how and when to use name ... mangling. ... It is up to the "producer" of compiler and linker to decide. ...
    (microsoft.public.vc.language)
  • Re: Headers!
    ... >>anywhere an explanation of what are .h files and how to write them. ... Note that extern "C" isn't just about name mangling; ... One thing it doesn't do is to cause a C++ compiler to interpret ...
    (alt.comp.lang.learn.c-cpp)
  • Re: interface blocks
    ... Name mangling is part of life in the C++ world. ... every compiler on a given platform mangles ... with name mangling the error is not found until link time instead ... Personally I use the word linker when refering to the last step ...
    (comp.lang.fortran)
  • how to create a C++ fn. which can be called from both C and C++ files
    ... Now this fun writtenincpp() is being called from other C++ files in the ... extern "C" void writtenincpp(int,char) ... The compiler now does not perform name mangling and this can now be ...
    (comp.lang.c)