Cython Sample Code ~~~~~~~~~~~~~~~~~~ NB - tested under Python 2.7 and Python 3.6 with Cython 0.29 with Visual Studio C compiler but it should work for all versions of Python, Cython and C compiler. (We also tested the 32-bit code using MinGW). If you are coding in Cython then you can link the Dinkey Pro/FD Runtime module directly to your code (rather than having to call an external Python extension). See the notes for Python sample code as to why this is preferable. Use: dpwin32_coff.obj for 32-bit code dpwin64.obj for 64-bit code The source files in the project are: File name Description objtest.pyx main source code file for Cython containing protection functions objtest.pxd implements the DRIS structure and function definitions ddpro.h Used by the pxd file so we can call DDProtCheck (a hack because it is difficult to declare a stdcall function in a pxd file) setup.py python file to compile the Cython sample code The sample code is just a guide. You should implement the protection in a stronger way using the techniques described in the "Increasing your Protection" chapter of the manual. NB - our sample code assumes that you are using 64-bit Python 3. If not then you will have to make some small modifications to setup.py: 32-bit Python: modify extra_objects to list "dpwin32_coff.obj" instead of "dpwin64.obj" Python 2: modify 'language_level' to be "2" (If you are using an old version of Python/Cython you may have to modify the objtest.pyx code. e.g. "DEMO" instead of b'DEMO' and use print instead of print() To compile run the following command: python setup.py build_ext --inplace --compiler=msvc (for mingw32 use --compiler=mingw32) So a makefile could look like this: all: python setup.py build_ext -c mingw32 --inplace rm -rf ./build rm -f *.c Code marked with !!!! are places where you should customise the sample code so that it will work properly: