Dag Sverre Seljebotn wrote: > Lisandro Dalcin wrote: Hi,
>> Dag, I know that the original idea of the dlopen() with RTLD_GLOBAL >> was mine, but you know... I'm so idiot sometimes... This is going to >> be a REAL pain to make it work, specially if you want to make this >> easily portable to the many platforms out there.... For example, Do >> the current implementation work on Windows? > > I have no idea. I know next to nothing about Windows development (which > goes beyond pre-2000-era Delphi GUI programming). And it would be a real > pain for me to find or set up a Windows workstation with enough tools to > find out. Hmm, judging from http://msdn.microsoft.com/en-us/library/ms684175.aspx and various manpages as well as my recollection of the way Python loads extension modules I believe that the problem does not exist on Windows, i.e. local vs. global symbols. But I obviously have not tested this. >> Would you agree to completelly change the way the refnany helper >> routines are imported?. I'm thinking on a ad-hoc way of doing that, >> similar but simpler to the way Cython extension modules can export API >> functions. >> >> The only requisite would be that the 'refnanny.so' extension module >> can be imported. Then, when you build Cython extensions with >> CYTHON_REFNANNY defined, some special code in the module init function >> imports the 'refnanny' module and get the pointer to a struct having >> pointers to the various routines... No more need to dlopen() or even >> import refnanny in order to enable it.... > > This sounds like the way Cython implements "api", one could build on > that. (But writing something dedicated in C might be just as well, > because all the other things can potentially be subject to refnannying). > > The reasons I've done what I've done is mostly to get something as quick > as possible. If what I've done can't work in Windows, I'd be happy to > accept a patch along the lines you suggest, but it is pretty far down on > my own list. (It would mean an extra pointer lookup per refcount call I > think, but speed is not an issue here...) > > An alternative is to write runtests.py to disable the refnanny on > Windows. As long as it is run on Unix prior to a Cython release it > should work. Well, it doesn't take much imagination to see someone coding Windows specific code that cannot be tested via Cygwin or Linux, so making this work on any supported platform would be a good thing. I have to port some code to MSVC that currently uses dlopen with RTLD_GLOBAL, but if Lisandro fixes the problem with Cython I would certainly be interested to see the result. Cheers, Michael _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
