简体   繁体   中英

Undefined symbol rom external library with Swig/Python

I have looked at this question but it doesn't seem to help my case.

I have a C++ library that I am wrapping parts of using SWIG (unfortunately swig 2.0). This library performs some socket communications with a remote server and I need to make use of it from Python. I am finally able to compile and link a .so file but during my testing, when importing the generated module, I get the following:

...
    _mod = imp.load_module('_YBB', fp, pathname, description)
ImportError: ./_YBB.so: undefined symbol: _Z11IPV4Gatewayhhhh

This undefined symbol equates to:

IPV4Gateway(unsigned char, unsigned char, unsigned char, unsigned char)

This is frustrating as I don't have a call to this function anywhere in the wrapped library. So it must be in the underlying socket library that I am calling.

Does anyone know what I have to do to clear up this undefined symbol?

Ah, never mind. It turns out that it was declared in a header file but never implemented. So swig (correctly) wrote a wrapper for it but was never able to link against the underlying implementation (which didn't exist).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM