ok, i see your point. I will refactor back to Javier's approach. My rationale was to reify the Cairo library as it is, luckily all the other examples work. If i add the shared pool NBCairoTypes to the NBCairo then NativeBoost automatically associates the type? Because i've been putting directly "int". Would be nice to have a couple of examples of NB (whenever the time is enough for you guys, i know you are busy) thanks for the feedback, Fernando On Mon, Dec 12, 2011 at 5:05 PM, Igor Stasenko <siguctua@gmail.com> wrote:
CairoSamplePrograms>>rectangleAndText does not works, because it uses a following method:
NBCairo>>selectFont: aFamily slant: slant weight: aWeight on: aNBCairoContext     <primitive: #primitiveNativeCall module: #NativeBoostPlugin>     ^self call: #(void cairo_select_font_face (NBCairoContext aNBCairoContext,                             String aFamily,
cairo_font_slant_t slant,
cairo_font_weight_t aWeight) )
and during code generation it barks that it unable to resolve 'cairo_font_slant_t' Â type. Because NBCairo class does not includes a corresponding shared pool (NBCairoTypes).
Also, Fernando, i don't like that you put everything into a single class (NBCairo). This is wrong, not object-oriented. The original organization made by Javier was much more closer to my tastes.
This approach to wrapping a library is too mechanical. It is much better to place calls at proper place(s) in proper classes, rather than putting everything into a single one. Which means that in this way you are at least 1 message send farther from real function call. But in your case its not even that..
NBCairoPattern>>status     ^ self cairo patternStatusOf: self
cairo     ^ NBCairo default
so , it is 2 extra message sends, instead of direct call to foreign function!
-- Best regards, Igor Stasenko.