Skip to main content.


This is the archive for July 2009

Saturday, July 25, 2009

I just discovered that Sun Studio has a strange idea of "optimization" when it comes to copying structures by value.

Thursday, July 09, 2009

--- What's the sound of a computer being shut down in a desert office?

Saturday, July 04, 2009

GD2 is a very cute library, and a must have for site developers (very used in PHP and perl....). As it is a very clean C library, with a very object-oriented spirit (despite it's plain C), It's the first target for the new Falcon automatic binding generator. The only problem is that it uses ANSI C FILE* streams to read and save images. It has actually also the ability to load from buffers, but providing a direct mapping is definitely a plus.

On Unices, that's not a problem. dup() + fdopen() provide a direct way to form an ANSI C FILE stream out of the system stream ID which I use in Falcon::Streams. On windows, I use System HANDLE (CreateHandle &c) to drive the Falcon::Streams.

But I found this snippet:


HANDLE hFile = CreateFile(...);
int handle = _open_osfhandle((LONG)hFile, _mode);
FILE* f = fdopen(handle, szMode);

With this, I can virtualize a function down in the Stream falcon class returning an integer system stream or raising an error if the stream isn't mapping a system file (i.e. streams can be net-bound or memory bound). The GD binding will have to wait the next version of falcon to use Stream oriented load/save functions, but I should release that next version quite soon.