|
Oktatás * Programozás 2 * Szkriptnyelvek * Adator. prog. Teaching * Prog. for Data Sci. Félévek Linkek * kalendárium |
DLang /
Calling D from PythonSuppose we use Python and we have a very slow function. Idea: implement that function in D and use it as a library from Python. Makefile: cat: cat Makefile so: # -shared → build a shared library # -fPIC → position-independent code (needed on Linux for shared libs) dmd -shared -fPIC mylib.d -of=libmylib.so run: ./main.py Write the D library
Notes:
Compile it with " Write the main Python program
Notes:
After this, you can execute your Python program: $ ./main.py 42 |
![]() Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |