[Tutor] Python C extension - which method?

Brad M thebigwurst at gmail.com
Fri May 4 05:30:25 EDT 2018


Hi all:

I want to create a C-based memory scanner for Python, and so far this is
how I do it:

Python:

from ctypes import cdll
mydll = cdll.LoadLibrary('hello.dll')
print(mydll.say_something())



and hello.dll:

#include <stdio.h>
__declspec(dllexport) int say_something()
{
    return 1980;
}


so the printout is "1980"


Is this alright? I am aware that there is another much more complicated
method such as this:

https://tutorialedge.net/python/python-c-extensions-tutorial/#building-and-installing-our-module



Is my method alright?

Thanks!


More information about the Tutor mailing list