Skip to content

PyInit_ on Windows requires dllexport #48

@rcoreilly

Description

@rcoreilly

To get my app to work on Windows, I had to fix the generated .c file to add the usual annoying __declspec(dllexport) thing for the PyInit function. I'm surprised this hasn't come up before! I gather there is a _wrap_ macro that should be used for this.

in module.py:841:

    #define MOD_INIT(name) PyObject* PyInit_##name(void)

needs to be wrapped or conditionally have the __declspec(dllexport) added for windows:

    #define MOD_INIT(name) PyObject* __declspec(dllexport) PyInit_##name(void)

I'm not using version 2 but probably that has the same issue?

This is for https://github.com/go-python/gopy -- using pybindgen to access Go from python. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions