Author erik.bray
Recipients erik.bray, jdemeyer
Date 2018-08-03.17:33:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1533317627.92.0.56676864532.issue34211@psf.upfronthosting.co.za>
In-reply-to
Content
> What makes functions different from variables? Aren't they essentially just pointers?

You're on the right track by noting a difference between functions and data variables.  I can tell you off the bat that when it comes to data imported from DLLs, non-functions are handled (somewhat by necessity) quite differently from functions.

That said, since you asked, I struggled to articulate *exactly* why this exact problem occurs on Cygwin (actually on Windows in general), so I thought about it for a while and wrote up an explanation in a blog post: http://iguananaut.net/blog/programming/windows-data-import.html

The TL;DR though is that limitations of how the runtime dynamic loader on Windows works are such that it's impossible to initialize static data with a pointer to some data in an external library.  The compiler knows this and prevents you from doing it.  The workaround is simple enough for most cases: Complete the initialization at runtime.  In the case of PyType_Type objects, PyType_Ready can set their base type at runtime just fine.
History
Date User Action Args
2018-08-03 17:33:47erik.braysetrecipients: + erik.bray, jdemeyer
2018-08-03 17:33:47erik.braysetmessageid: <1533317627.92.0.56676864532.issue34211@psf.upfronthosting.co.za>
2018-08-03 17:33:47erik.braylinkissue34211 messages
2018-08-03 17:33:47erik.braycreate