[Vm-dev] FFI, ExternalStructures and Unix (a sad incompatibility story)

Esteban Lorenzano estebanlm at gmail.com
Fri Jan 6 18:55:21 UTC 2012


Hi,

I'm finishing an app for a customer who has to be installed on monday. Last wednesday, customer said that the system, who was thought to run on Windows and developed on Mac, has to run also on Linux. 
"No problem", I said to him... and started testing the application (a small app made with Pharo+Glamour+Magritte+HPDF+Mongo) and everything looks just fine... until I found this problem: HPDF package, who relies on FFI and works perfect on Windows and Macs, was not working on linux. 
"A library problem", I thought, then I downloaded libhpdf sources, compiled and started tracing it to see what was the problem.
After a while (a loooooong while), I came up with this conclusión: 

HPDF_New function creates a document who answers HPDF_Doc, who is a pointer to a structure... so void* should be a correct reference in smalltalk side... isn't? 

well... my HPDFReference class, who is an ExternalStructure who maps to a void*, just does not works (in Linux)... it is getting a mysterious number as a reference. Maybe a number encoding diference? littleendian/bigendian? I don't know (and no time to invest right now here: on monday I'm going to production with this app). 

What I do know is: after changing all HPDFReference references with "long" (void* are longs also)... everything started to work... 

So... yes... this is a long story to report a bug on ExternalStructure conformations in Unix :)

Cheers, 
Esteban


More information about the Vm-dev mailing list