Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #4690

Re: Sharing data between ruby and a custom dll with Win32API

From Su Zhang <zhangsu@live.com>
Newsgroups comp.lang.ruby
Subject Re: Sharing data between ruby and a custom dll with Win32API
Date 2011-05-17 15:00 -0500
Organization Service de news de lacave.net
Message-ID <5da0f9c6a53ac8a2ac026645fdbafd2e@ruby-forum.com> (permalink)
References <5daf6b7d2acef28191055cb217178954@ruby-forum.com>

Show all headers | View raw


Hi Futar,

I suppose you are using 'p' as the return type specifier of Win32API; 
this is interpreted as a pointer to a null-terminated string.Therefore, 
any null byte in your array of floats will mark the end of the "string" 
buffer.

In this case, I think you can simply reference the same buffer you pass 
to @getkaplamatrix.

matrix2 = matrix.pack("f*")
@getKaplaMatrix.call(index, matrix2)
matrix3 = matrix2.unpack("f*")

And if you really do need to return a reference to something, you will 
often have to return it as an integer address and manipulate (reference 
and dereference) it through native interfaces such as RtlMoveMemory.

Su

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Sharing data between ruby and a custom dll with Win32API "futar C." <bourinax@yopmail.com> - 2011-05-16 05:30 -0500
  Re: Sharing data between ruby and a custom dll with Win32API Su Zhang <zhangsu@live.com> - 2011-05-17 15:00 -0500
  Re: Sharing data between ruby and a custom dll with Win32API "futar C." <bourinax@yopmail.com> - 2011-05-18 06:24 -0500

csiph-web