I wan\'t want to create a cross-plattform programm that embedds the python interpreter, and compile it with MinGW. But the Python Binary distribution provides no libraries f
EmbeddingPython.c
#include
int main(int argc, char *argv[])
{
Py_SetProgramName((wchar_t *)argv[0]); /* optional but recommended */
Py_Initialize();
PyRun_SimpleString("from time import time,ctime\n"
"print('Today is', ctime(time()))\n");
Py_Finalize();
return 0;
}
and use gcc as following:
gcc EmbeddingPython.c -I C:\Python34\include -LC:/Python34/libs -lpython34 -o a.exe
and it works as we expected.
D:\>a.exe
Today is Fri Aug 29 15:14:04 2014