From: "Carlo E. Prelz" Date: 2013-04-08T19:04:35+09:00 Subject: Re: Mapping string data ptr to buffer in ffi Subject: Re: Mapping string data ptr to buffer in ffi Date: lun 08 apr 13 06:49:27 +0900 Quoting se gm (lists@ruby-forum.com): > >You need a method call, either from > >Ruby side > I need only one blocking syncronization call from Ruby to start working > with the string. Getters method calls which would copy 512m string are > not a viable option. So no other option except the one I was asking > about. It remains that, if you want to manipulate strings from Ruby, you must at some point create Ruby String objects. Either you do all your string processing in C, or at some point you must do the bridging. The normal way is to allow Ruby GC to manage these objects. I believe you could twiddle the main String class from C (see string.c in the Ruby code) to have a string whose content is unmodifiable and is held in a memory area managed from C (say, using SystemV IPC shared memory), but I believe it would be a huge work. I used shared memory in the past from C, but when the Ruby part needed to access the data, I created a String object (with rb_str_new). Carlo -- * Se la Strada e la sua Virtu' non fossero state messe da parte, * K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)