yeah I know there is no such thing as types in smalltalk , since everything is an object and the language is dynamic. I was referring to how those objects map to C types.
But you are correct it is simpler than I was assuming. The more I think about it the more it makes sense. Igor Stasenko wrote > On 2 July 2013 23:04, kilon < > [email protected] > > wrote: >> Thank you Igor for the clarifications, the reason why I prefer using the >> nativeboost methods is because : >> >> a) I was not sure if smalltalk types map correctly to C types and which >> Smalltalk types correspond to which C types > > well, there's no such thing as 'types' in smalltalk :) > >> >> b) many opengl functions ask for the address of the value and the value >> itself. And I have no clue how to obtain memory addresses of smalltalk >> types. >> > > you don't. The value can have a type, but address don't. > Address is just a location in memory, where the value(s) (could be) > stored. > > For any function which takes a pointer, you can pass an instance of > ByteArray, > or instance of NBExternalAddress to it. In first case, a pointer to > first byte of bytearray > will be passed to function, in second one , the value of address. > > So, you either allocate buffer in object memory, or external memory.. > fill it with whatever > it needs and pass to function. Does that sounds simple enough? > >> c) I was not sure whether Pharo VM or garbage collector would move my >> data >> making my pointers invalid. >> >> But if you say its ok, I trust you. When exactly is ok to use smalltalk >> types ? >> > if you pass a pointer to something in object memory into function, > make sure GC cannot move the object while function uses/accessing its > contents. > > and it is only for pointers. For arguments which is passed by value > (ints/floats), you don't have to care. > >> -- >> View this message in context: >> http://forum.world.st/Understanding-NBOpenGL-tp4686514p4696955.html >> Sent from the Pharo Smalltalk Developers mailing list archive at >> Nabble.com. >> > > > > -- > Best regards, > Igor Stasenko. -- View this message in context: http://forum.world.st/Understanding-NBOpenGL-tp4686514p4697076.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
