[Tutor] calling printf() in a C language DLL using ctypes.CDLL
thebigwurst at gmail.com
Tue May 8 05:39:02 EDT 2018
I am trying out some c based module in a .dll file on windows.
__declspec(dllexport) void helloworld()
I compile this by typing this in the command line:
cl /LD /I C:\python\include helloworld.c C:\python\libs\python36.lib
I get helloworld.dll for the above.
and the following is the python caller
mydll = ctypes.CDLL('helloworld')
However, this doesn't print anything on the python window.
What I would like is to do is to be able to use printf() in my .dll
by having the c code pop up a console window to print or
to have something that can print() in the python window somehow.
Is this possible?
More information about the Tutor