Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 460
akaltar Avatar asked Oct 27 '25 20:10

akaltar


1 Answers

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.

like image 129
Artem Selivanov Avatar answered Oct 30 '25 12:10

Artem Selivanov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!