Solved

What  separates c++ mangle names from their unmangled versions

Posted on 2006-11-01
1
357 Views
Last Modified: 2008-02-01

I am having trouble linking an application.   I can link using an old .a file, but with the newer .a file,  the link fials because it can't find _ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb which c++filt demangles to:  

MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool)

The C version of this entry point is:  MPI_Op_Create

And, indeed in the old .so file (which I can link), there is a reference to MPI_Op_Create and no reference to ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb whereas in the new .so file (which I cannot link),
there is a reference to _ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb but none to MPI_Op_Create.

Unfortunately, I can't recreate the old .so file, so I have to work from the new one.  

The .a file from which the .so files are built contains references to both _ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb and MPI_Op_Create.  (The two .so files are built from different versions of those .a files, but all versions of the .a files contain references to both entry points).

What might have changed to cause the new .so file to reference _ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb instead of MPI_Op_Create.  

Thanks,
  Ken







http://www.mainserver.state.mn.us/bookmgr-cgi/bookmgr.exe/handheld/BOOKS/IBMBK.Z6UNIX.IPEZPS00.BOOK/4.156?SHELF=IBMBK.Z6UNIX.BPXZSH51.BKSHELF&DT=20010104150826


0
Comment
Question by:klopter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 500 total points
ID: 17850971
>>>> What might have changed to cause the new .so file to reference
>>>>_ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb instead of MPI_Op_Create.  

You need to switch off C++ name mangling when the function was declared. Normally you do that in the header file:

#ifdef __cplusplus
extern "C"
{
#endif

typedef struct OpTag
{
     void Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool);
} Op;

#ifdef __cplusplus
}
#endif


You also could try to  put the extern "C" around the include of the header file where the Init function was defined.

// some.cpp

extern "C"
{
    #include <op.h>
}

Regards, Alex
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question