Python Forum

Full Version: Compile c method in real time
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

Here is my confidence
Python3.7
Windows 10

In ma code, I use c user32.dll throw a method in c language

My problem :

When I try to run the code I have an invalid syntax error in c method

Question :

How to say python to compile in real time c code when the interpreter read it ?


Thanks for your support

Best regards and hope your new year 2019

Battant
If you have a c compiler installed (such as llvm), then call it.
Python isn't a c compiler, it can't compile c code on it's own.
You can use cython which does this very well. (but it's not python, start with the FAQ)
Hello,

Thanks for your answers.

I have found this code :

https://stackoverflow.com/questions/2524...rom-python

Question :

How could I run it ?

Thanks for your support

Best regards

Battant
The ctypes module doesn't compile C code. It is a foreign function interface which allows python code to call C library functions with some effort from the programmer on the python side. Start with the official documentation of module ctypes, then read online tutorials.