c++ - Compiling python into a shared library -


i have bunch of python code "compile" shared library c interface can linked other c/c++ programs , work without depending on many other libs (perhaps python , other dlls should included directory final lib).

i don't want rewrite python code c++ this. can of course, best have standalone lib can used dll/so lib.

i have tried cython , wanted compile python c , compile c code dll doesn't seem work quite yet (i haven't been able make work flawlessly yet). , tried bbfreeze - bbfreeze support creating .so file? wasn't able find out how it. know?

do know of other options more straightforward? python code needs compiled once. , best of if creates single .so file no matter how big works without many dependencies.

you can use python library inside c++ application: it's called python/c api.

the idea initialize own interpreter, load script in it. can expose c++ objects through global variables or modules inside python interpreter code interact with, can run python functions directly c++ code.

now, understand might want have python scripts embedded inside shared library: not easy task, traditional gnu toolchain. there multiple techniques achieve this, none official, , seem way complicated opposed having script in external file.

if goal hide scripts end-user, sign them or encrypt them private key , embed public key inside library, keep in mind key can retrieved enough motivation.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -