Re: Euphoria 4.1 problem - as relates to tinewg
- Posted by jimcbrown (admin) May 01, 2016
- 3482 views
Hallo
[...]
I do not recall the specific reasons that this was done, but Matt usually knows what he's doing when it comes to things like this.
Please, don't get me wrong. But this sounds a little like:
http://www.memecenter.com/search/trust%20me%20im%20an%20engineer
Trust me, I'm a programmer.
So far, i do not really work on tinewg regulary, but i remember that i stopped using Eu4.1 around 2013 (the last release for the Designer)
I really can't remember everthing why i did this and my english is really not good enough to explain it.
Hmm. Perhaps try explaining what you can remember in your native language and let the rest of us worry about how to interpret it??
I see it like this:
Win32 Api handles need to be 32bit unsigned (check MSDN for this).
I guess I need a more direct link. I did check, but the only reference I could find doesn't explicitly specify this:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx
It worked for decades using signed ints.
All the above is okay for Eu4.1 64bit but may crash on new 32bit Window Versions.
Maybe Eu4.1 on Win32 needs some more testing. Becouse i think WIn32 will be here for a few more years
Normally, I'd let mattlewis explain himself. But he's been gone for a few months now - which is very unusual for him. So this time, I wouldn't hold my breath waiting for his response. Perhaps someone else with sufficient knowledge (ghaberek?) can fill in for him.
Unfortunately, unless mattlewis comes back or a member of the dev team can confidently state that this deliberate 3 year old code change is wrong, this is not likely to get fixed.
C_HANDLE is a Windoze specific concept that one wouldn't use on nix. Hence my minimal knowledge on it.
In the example (SetFont/Createfont) i pass a signed handle via sendmessage in (unsigned)wparam (wparam is unsigned in dll.e), maybe not the best you can do.
Edit2: On the other side, this seems not to affect the function ...
That said, I wonder if this could be part of the problem for others. It's not so much that Euphoria is treating the value of the HANDLE incorrectly (passing it from C to Eu as a signed value), but that the value is being translated back and forth to the C code in an inconsistent way (e.g. treating it as signed when it comes in from C to Eu, but then treating it as unsigned when it is passed back from Eu to C).
Things always get ugly when you have to treat pointers as ints or vice versa.