简体   繁体   中英

Python .pyd equivalent on linux

I have some c++ code that is working as a python module using boost. It is actually a plugin of another c++ python module.

On windows, I have to link against a libavg.pyd file of this library.

On linux I tried linking against libavg.so , but when doing that, dlopen fails with undefined references to functions that should be defined in libavg.pyd .

What is the equivalent of linking to a .pyd file on linux?

On linux .pyd equivalent is .so files.

I'm not know about Boost::Python specifics, but you can try to use script like this:

from distutils.core import setup, Extension

module = Extension('ModuleName', sources=['yourmodule.cpp'], language="c++")

setup(name="ModuleName",
      version='1.0',
      description='My package',
      ext_modules=[module])

And after this just import your built module with .so-extension.

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