Re: 3.2, Wrapping DLLs and Float types

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jeremy Cowgar wrote:
> 
> I've wrapped PgSQL and used Sqlite, PCRE and Iup in 3.2 now w/no problems,
> once
> the stack offset was fixed for gcc 4.3.0, however, none of those use the Float
> type.
> 
> Now, before going further, the C examples I have created work great, and the
> wrapper that I've created works identical to the C examples when executed with
> Euphoria 3.1.1. However, the results are different with the same wrapper, the
> same examples on the same computer when run with 3.2.
> 
> I am now wrapping LibHaru, which will be released into the archives and will
> give Euphoria PDF capabilities. However, floats, I have identified what I
> think
> is a bug, but I do not have the knowledge to track it down. The bug is this:
> 
> }}}
<eucode>
> constant
> fHPDF_Page_SetFontAndSize = define_c_func(lib, "HPDF_Page_SetFontAndSize", 
>     {P, P, F}, I),
> fHPDF_Page_TextOut = define_c_func(lib, "HPDF_Page_TextOut", 
>     {P, F, F, P}, I)
> 
> -- P = C_POINTER, F = C_FLOAT, I = C_INT.
> </eucode>
{{{

> 
> The parameters for TextOut are: Page, X, Y and Text. The problem is the
> resulting
> PDF outputs for X, Y: 761 0 Td  when it should be 60 761. What that tells PDF
> readers is unimportant, the part that is important is that Y is being shifted
> to X's position, and Y is 0.
> 
> The parameters for SetFontAndSize are: Page, Font, Size. The Font section is
> output correctly, but the size is in the PDF as: 0 Tf when it should be 12 Tf.
> 
> So, once again the Float is being lost/corrupted somehow in 3.2. Again, this
> all works great in 3.1.1.
> 
> Thanks for any input.
> 
> --
> Jeremy Cowgar
> <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>

This is getting outside of my expertise, but where there any compiler flags
different for 3.0 than from 3.2? Maybe the offset you changed was still a little
wrong but close enough to work most of the time?

I'm wondering if one of the float arguments is being passed in a register
instead of on the stack, or if it is being consumed by another function, or
whether it is being passed at all.

Also, are you sure the arguments are supposed to be floats and not doubles? I
know they're different sizes but I don't know if GCC allocates the same amount of
space on the stack for them.

--
A complex system that works is invariably found to have evolved from a simple
system that works.
--John Gall's 15th law of Systemantics.

"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare

j.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu