[PD-dev] open_via_path() weirdness

Hans-Christoph Steiner hans at at.or.at
Tue Apr 28 03:27:59 CEST 2009

On Apr 27, 2009, at 6:28 PM, Martin Peach wrote:

> IOhannes m zmoelnig wrote:
>> hi all,
>> in the course of trying to find the filehandle-leak bug in Gem i  
>> found a weird problem with open_via_path().
>> can anybody find anything wrong with the attached code?
>> if not, try the attached patch as well.
> A minor thing is that you use #ifdef __WIN32__ instead of #ifdef  
> MSW, which may or may not work.

_WIN32 is the preferred version of that macro:


>> everything works fine on linux, but on w32 i cannot close the file- 
>> handle anymore (i get an errno of EBADF, which means that fd isn't  
>> a valid open file descriptor).
>> which in turn results in a filehandle leak.
> I don't know if it's related but I had trouble with the very similar  
> canvas_open on WinXP in the [which] object. I compiled it with  
> VisualStudioC++2005ExpressEdition against various pd.libs from  
> Miller's site. Every time Pd would crash whenever i tried to use the  
> fd, although the same code runs fine on linux (no need for a pd.lib  
> there).
> So imagine my surprise when which works fine when built as part of  
> pd-extended on Hans' machine. So I think that I'm seeing some  
> incompatibility of the dlls as made with MinGW and VC.

Yeah, I think its probably good to stick with MinGW throughout.


> Martin
>> i notice that hardly anyone (esp. Pd itself) uses open_via_path().
>> is there a reason for that? is it buggy? (couldn't find anything  
>> wrong though)
>> i use it quite a lot, e.g. in [msgfile]; i guess nobody ever tried  
>> to open > 1000 files with msgfile on w32, so the error never  
>> appeared...
>> fgamsdr
>> IOhannes
>> ------------------------------------------------------------------------
>> _______________________________________________
>> Pd-dev mailing list
>> Pd-dev at iem.at
>> http://lists.puredata.info/listinfo/pd-dev
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev


All information should be free.  - the hacker ethic

More information about the Pd-dev mailing list