Skip to content

Panaedra/panaedra_c_pythonbridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Paneadra Python Bridge

Important Notice

This repository has not yet been updated with the latest fixes for the Prague demo.

Please be patient for a couple more days.

E.T.A.: Wednesday 22nd Nov 2017.

This repository will be reset at that time, due to changes in the private repository conversion and anonymization.

Kind regards, Tijs Wickardt

This readme continued...

The Paneadra Python Bridge enables you to embed the CPython interpreter into a runtime that supports dynamic loading of Unix shared objects and/or Windows DLLs.

It was written for embedding CPython into the Progress OpenEdge ABL runtime, to facilitate software integration with various third party projects.

The Paneadra Python Bridge is written in C. Supported platforms are currently: Windows, Linux, IBM AIX.

Build

Gcc compile on Linux

As an example, here is the runbook for compiling on a standard Ubuntu Xenial x64 distibution, running on Vagrant plus VirtualBox on a Windows workstation.

  1. Create a panaedra folder somewhere on your windows machine
  2. Add an environment variable PanaedraWorkspace that points to the folder above. End with an extra backslash.
    • Example: PanaedraWorkspace=C:\work\panaedra\
  3. Pull the panaedra_c_pythonbridge repository into the %PanaedraWorkspace% folder
  4. Install Vagrant and VirtualBox, make sure VTX is on in your BIOS, and setup a vagrant machine of Ubuntu Xenial x64, latest version
  5. Go to the vagrant vm folder, and halt the vm:
    cd /d "C:\vm\ubuntu.xenial64"
    vagrant halt
  6. Put the following in the Vagrantfile:
    config.vm.synced_folder "../../work/panaedra", "/panaedra"
  7. Go to the vagrant vm folder, and up the vm, plus putty:
    cd /d "C:\vm\ubuntu.xenial64"
    vagrant up
    vagrant putty
  8. From the ssh terminal, install prerequisites and create the shared object:
    sudo apt install python 2.7-dev
    sudo apt install python-dev
    cd "/panaedra/panaedra_c_pythonbridge/src/panaedra/mxroot/mxpython/c_source/"
    # Compiling
    gcc $(python2.7-config --cflags) -fPIC -c panaedra_pythonbridge.c
    # Linking, create shared object.
    # Note: Do an explicit link to libpython as well, because OE does not allow undefined symbols (even when they are fine at runtime).
    # Symptoms:
    #   DLL Error : /panaedra/panaedra_c_pythonbridge/src/panaedra/mxroot/mxpython/c_source/panaedra_pythonbridge.so
    #   undefined symbol: _PyByteArray_empty_string (8014)
    #   Could not load DLL procedure panaedra/mxroot/mxpython/c_source/panaedra_pythonbridge.so. (3258)
    # Ref: https://github.com/Cantera/cantera/issues/319 , https://stackoverflow.com/questions/16112310/explicitly-linking-a-local-shared-object-library , 
    gcc $(python2.7-config --cflags --ldflags) -shared -o panaedra_pythonbridge.so panaedra_pythonbridge.o -lc /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
    # Intermediate object file can be removed
    rm panaedra_pythonbridge.o
    # Do a quick check for undefined symbols (see above)
    ldd -r panaedra_pythonbridge.so
    
  9. If you are a Progress OpenEdge user, now's a good time to look at the panaedra_oe_demo_lowdep repository, to see the Python Bridge in action.

About

Panaedra CPython Bridge for embedding Python by .so or unmanaged .dll

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages