Void Star
Void Star

Reputation: 2521

Python C bindings Py_InitModule issue

This latest programming project of mine has pushed some boundaries I haven't crossed before; mainly, I've begun doing some serious C programming. Stack Overflow's users have been exceptionally helpful so far, so I will draw on your knowledge again. I want to write some bindings C function bindings (drawing pixels to the screen using SDL) for Python, and I am, once again, stuck on a compiler error.

This line:

Py_InitModule3("ezpix", ezpix_methods, "ezpix extension");

Gives me this error:

POLINK: error: Unresolved external symbol '_Py_InitModule3'.
POLINK: fatal error: 1 unresolved external(s).

I find it odd that it says _Py_InitModule3 when I put Py_InitModule3, is the syntax parser adding in an underscore or something? I'm using Pelles C for Windows, and the rest of my code (including the scarier looking bits) have compiled just fine.

Upvotes: 0

Views: 1724

Answers (1)

Eryk Sun
Eryk Sun

Reputation: 34270

That's the mangled name of the function, which isn't found in the library because it's a macro from modsupport.h:

#define Py_InitModule3(name, methods, doc) \
    Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
                   PYTHON_API_VERSION)

modsupport.h gets included by Python.h.

Upvotes: 1

Related Questions