 |
Forums |
Admin Discussion Forums: help Start New Thread
| Message: 93639 |
 |
BY: Jarmo Pertman (juuser) DATE: 2010-05-15 18:50 SUBJECT: pointers and whatnot in Win32::API Hello.
I'm trying to convert one Ruby library, which uses Ruby::DL to use Win32::API and i'm in trouble.
I have to use GlobalAlloc and GlobalLock.
Currently they are declared like this in this library:
extern "void* GlobalAlloc(long, long)"
extern "void* GlobalLock(void*)"
And in windows-pr they are like this:
API.new('GlobalAlloc', 'LL', 'L')
API.new('GlobalLock', 'L', 'L')
So, they are returning long instead of pointer.
And now i got a problem when trying to convert this line:
a = b.to_s(10) + c.to_s(26) + d.to_s(22)
where b, c and d are all DL::PtrData
Since b and c were done with Array#pack#to_ptr, then i just removed #to_ptr and converted them like this:
a = b[0..9] + c[0..25]
But the problem is with d, because it is a Fixnum. How could i solve this problem? Should i handle this situation somehow differently and make GlobalLock and GlobalAlloc to return pointers instead?
Jarmo | |
Thread View
Post a followup to this message
|
 |