Hi everybody, i´m using UnifiedFFI with Chipmunk2D library . I want to get a pointer to a C Structure (cpBody) and set a position to it. I have a subClass of FFIOpaqueObject to handle pointer. This is the "new " ffiCall : self ffiCall: #(cpBody* cpBodyNew(cpFloat m, cpFloat i)) And this is a "seter" ffiCall: self ffiCall: #( void cpBodySetPosition( self, cpVect vector ) ). I`m not getting any "error" but the position is not updating. I tried the same using Chipmunk directly and it works, so there is a problem with what i have in Pharo. Any suggestion? Thanks in advance. Alvaro Piorno
Hi alvaro Thanks for the question. If you have any suggestion for the booklet on UFFI let us know. I will let esteban anwser because I do not know. BTW did you check the chipmunk existing bindings? Stef On Fri, Sep 15, 2017 at 3:42 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi everybody, i´m using UnifiedFFI with Chipmunk2D library . I want to get a pointer to a C Structure (cpBody) and set a position to it. I have a subClass of FFIOpaqueObject to handle pointer.
This is the "new " ffiCall : self ffiCall: #(cpBody* cpBodyNew(cpFloat m, cpFloat i))
And this is a "seter" ffiCall:
self ffiCall: #( void cpBodySetPosition( self, cpVect vector ) ).
I`m not getting any "error" but the position is not updating. I tried the same using Chipmunk directly and it works, so there is a problem with what i have in Pharo. Any suggestion? Thanks in advance.
Alvaro Piorno
Hi Stephan, Thanks for your answer, i found the booklet, but it was a draft, so it was incomplete. An example of FFIOpaqueObject would be healpful, i think. Esteban already talked to me, and is helping me with this. What do you mean with "Chipmunk existing bindings" ?. 2017-09-16 4:42 GMT-03:00 Stephane Ducasse <stepharo.self@gmail.com>:
Hi alvaro
Thanks for the question. If you have any suggestion for the booklet on UFFI let us know. I will let esteban anwser because I do not know. BTW did you check the chipmunk existing bindings?
Stef
On Fri, Sep 15, 2017 at 3:42 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi everybody, i´m using UnifiedFFI with Chipmunk2D library . I want to get a pointer to a C Structure (cpBody) and set a position to it. I have a subClass of FFIOpaqueObject to handle pointer.
This is the "new " ffiCall : self ffiCall: #(cpBody* cpBodyNew(cpFloat m, cpFloat i))
And this is a "seter" ffiCall:
self ffiCall: #( void cpBodySetPosition( self, cpVect vector ) ).
I`m not getting any "error" but the position is not updating. I tried the same using Chipmunk directly and it works, so there is a problem with what i have in Pharo. Any suggestion? Thanks in advance.
Alvaro Piorno
On Sat, Sep 16, 2017 at 09:09:23AM -0300, alvaro piorno wrote:
incomplete. An example of FFIOpaqueObject would be healpful, i think.
Hi Alvaro, I mentioned libffidemo on Discord. Reading the blog post and the library's unit tests will hopefully make clearer how to use FFIOpaqueObject. http://www.samadhiweb.com/blog/2016.03.17.demoffi.html https://github.com/PierceNg/libffidemo Pierce
Jean-Baptiste Arnaud extended the Chipmunk binding that esteban did a while ago and Damien Pollet did a tutorial at ESUG Annecy to show how to use FFI (nativeboost) to call chipmunk so it should be around. Stef On Sat, Sep 16, 2017 at 2:09 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi Stephan, Thanks for your answer, i found the booklet, but it was a draft, so it was incomplete. An example of FFIOpaqueObject would be healpful, i think. Esteban already talked to me, and is helping me with this. What do you mean with "Chipmunk existing bindings" ?.
2017-09-16 4:42 GMT-03:00 Stephane Ducasse <stepharo.self@gmail.com>:
Hi alvaro
Thanks for the question. If you have any suggestion for the booklet on UFFI let us know. I will let esteban anwser because I do not know. BTW did you check the chipmunk existing bindings?
Stef
On Fri, Sep 15, 2017 at 3:42 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi everybody, i´m using UnifiedFFI with Chipmunk2D library . I want to get a pointer to a C Structure (cpBody) and set a position to it. I have a subClass of FFIOpaqueObject to handle pointer.
This is the "new " ffiCall : self ffiCall: #(cpBody* cpBodyNew(cpFloat m, cpFloat i))
And this is a "seter" ffiCall:
self ffiCall: #( void cpBodySetPosition( self, cpVect vector ) ).
I`m not getting any "error" but the position is not updating. I tried the same using Chipmunk directly and it works, so there is a problem with what i have in Pharo. Any suggestion? Thanks in advance.
Alvaro Piorno
Look at http://smalltalkhub.com/#!/~estebanlm/Storm A small game engine. For being able to use this you will need: NB capable VM. Athens. Chipmunk library. You can download it at Chipmunk On Sun, Sep 17, 2017 at 1:31 PM, Stephane Ducasse <stepharo.self@gmail.com> wrote:
Jean-Baptiste Arnaud extended the Chipmunk binding that esteban did a while ago and Damien Pollet did a tutorial at ESUG Annecy to show how to use FFI (nativeboost) to call chipmunk so it should be around.
Stef
On Sat, Sep 16, 2017 at 2:09 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi Stephan, Thanks for your answer, i found the booklet, but it was a draft, so it was incomplete. An example of FFIOpaqueObject would be healpful, i think. Esteban already talked to me, and is helping me with this. What do you mean with "Chipmunk existing bindings" ?.
2017-09-16 4:42 GMT-03:00 Stephane Ducasse <stepharo.self@gmail.com>:
Hi alvaro
Thanks for the question. If you have any suggestion for the booklet on UFFI let us know. I will let esteban anwser because I do not know. BTW did you check the chipmunk existing bindings?
Stef
On Fri, Sep 15, 2017 at 3:42 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi everybody, i´m using UnifiedFFI with Chipmunk2D library . I want to get a pointer to a C Structure (cpBody) and set a position to it. I have a subClass of FFIOpaqueObject to handle pointer.
This is the "new " ffiCall : self ffiCall: #(cpBody* cpBodyNew(cpFloat m, cpFloat i))
And this is a "seter" ffiCall:
self ffiCall: #( void cpBodySetPosition( self, cpVect vector ) ).
I`m not getting any "error" but the position is not updating. I tried the same using Chipmunk directly and it works, so there is a problem with what i have in Pharo. Any suggestion? Thanks in advance.
Alvaro Piorno
yes, he is using that. but he is porting it yo UFFI (it was NB) and to 64bits and to Chipmunk 7.0 (it was 6.1) So⦠in one of those places, is failing :( Esteban
On 17 Sep 2017, at 13:32, Stephane Ducasse <stepharo.self@gmail.com> wrote:
Look at http://smalltalkhub.com/#!/~estebanlm/Storm
A small game engine.
For being able to use this you will need:
NB capable VM. Athens. Chipmunk library. You can download it at Chipmunk
On Sun, Sep 17, 2017 at 1:31 PM, Stephane Ducasse <stepharo.self@gmail.com> wrote:
Jean-Baptiste Arnaud extended the Chipmunk binding that esteban did a while ago and Damien Pollet did a tutorial at ESUG Annecy to show how to use FFI (nativeboost) to call chipmunk so it should be around.
Stef
On Sat, Sep 16, 2017 at 2:09 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi Stephan, Thanks for your answer, i found the booklet, but it was a draft, so it was incomplete. An example of FFIOpaqueObject would be healpful, i think. Esteban already talked to me, and is helping me with this. What do you mean with "Chipmunk existing bindings" ?.
2017-09-16 4:42 GMT-03:00 Stephane Ducasse <stepharo.self@gmail.com>:
Hi alvaro
Thanks for the question. If you have any suggestion for the booklet on UFFI let us know. I will let esteban anwser because I do not know. BTW did you check the chipmunk existing bindings?
Stef
On Fri, Sep 15, 2017 at 3:42 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi everybody, i´m using UnifiedFFI with Chipmunk2D library . I want to get a pointer to a C Structure (cpBody) and set a position to it. I have a subClass of FFIOpaqueObject to handle pointer.
This is the "new " ffiCall : self ffiCall: #(cpBody* cpBodyNew(cpFloat m, cpFloat i))
And this is a "seter" ffiCall:
self ffiCall: #( void cpBodySetPosition( self, cpVect vector ) ).
I`m not getting any "error" but the position is not updating. I tried the same using Chipmunk directly and it works, so there is a problem with what i have in Pharo. Any suggestion? Thanks in advance.
Alvaro Piorno
Esteban and you remember you promise me to work on the documentation :) On Sun, Sep 17, 2017 at 1:35 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
yes, he is using that. but he is porting it yo UFFI (it was NB) and to 64bits and to Chipmunk 7.0 (it was 6.1)
So⦠in one of those places, is failing :(
Esteban
On 17 Sep 2017, at 13:32, Stephane Ducasse <stepharo.self@gmail.com> wrote:
Look at http://smalltalkhub.com/#!/~estebanlm/Storm
A small game engine.
For being able to use this you will need:
NB capable VM. Athens. Chipmunk library. You can download it at Chipmunk
On Sun, Sep 17, 2017 at 1:31 PM, Stephane Ducasse <stepharo.self@gmail.com> wrote:
Jean-Baptiste Arnaud extended the Chipmunk binding that esteban did a while ago and Damien Pollet did a tutorial at ESUG Annecy to show how to use FFI (nativeboost) to call chipmunk so it should be around.
Stef
On Sat, Sep 16, 2017 at 2:09 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi Stephan, Thanks for your answer, i found the booklet, but it was a draft, so it was incomplete. An example of FFIOpaqueObject would be healpful, i think. Esteban already talked to me, and is helping me with this. What do you mean with "Chipmunk existing bindings" ?.
2017-09-16 4:42 GMT-03:00 Stephane Ducasse <stepharo.self@gmail.com>:
Hi alvaro
Thanks for the question. If you have any suggestion for the booklet on UFFI let us know. I will let esteban anwser because I do not know. BTW did you check the chipmunk existing bindings?
Stef
On Fri, Sep 15, 2017 at 3:42 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi everybody, i´m using UnifiedFFI with Chipmunk2D library . I want to get a pointer to a C Structure (cpBody) and set a position to it. I have a subClass of FFIOpaqueObject to handle pointer.
This is the "new " ffiCall : self ffiCall: #(cpBody* cpBodyNew(cpFloat m, cpFloat i))
And this is a "seter" ffiCall:
self ffiCall: #( void cpBodySetPosition( self, cpVect vector ) ).
I`m not getting any "error" but the position is not updating. I tried the same using Chipmunk directly and it works, so there is a problem with what i have in Pharo. Any suggestion? Thanks in advance.
Alvaro Piorno
On Fri, Sep 15, 2017 at 9:42 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi everybody, i´m using UnifiedFFI with Chipmunk2D library . I want to get a pointer to a C Structure (cpBody) and set a position to it. I have a subClass of FFIOpaqueObject to handle pointer.
This is the "new " ffiCall : self ffiCall: #(cpBody* cpBodyNew(cpFloat m, cpFloat i))
And this is a "seter" ffiCall:
self ffiCall: #( void cpBodySetPosition( self, cpVect vector ) ).
I`m not getting any "error" but the position is not updating. I tried the same using Chipmunk directly and it works, so there is a problem with what i have in Pharo.
A general approach might be to write your own C wrapper around Chipmunk library functions which just does a debug printout of parameters before calling the wrapped function. Use these for both from Pharo and your "direct" trial, and see how they compare. cheers -ben
Pierce: I already see the repo, i kwnow now the difference and is not the problem i have now. I made the suggestion for book draft i found, because theres is no example on it. Thanks for answer. Stephan : Yes, as Esteban said i´m using that, I´m extending (or trying) Esteban´s project. And i´m having the problem that esteban metioned. Thanks for answer. Ben: I have in C the same example as in Pharo using the physics of CHipmunk, and in C is working fine, there is a problem in the call to the function from Pharo in 64 bits. Thanks for answer. 2017-09-17 12:11 GMT-03:00 Ben Coman <btc@openinworld.com>:
On Fri, Sep 15, 2017 at 9:42 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi everybody, i´m using UnifiedFFI with Chipmunk2D library . I want to get a pointer to a C Structure (cpBody) and set a position to it. I have a subClass of FFIOpaqueObject to handle pointer.
This is the "new " ffiCall : self ffiCall: #(cpBody* cpBodyNew(cpFloat m, cpFloat i))
And this is a "seter" ffiCall:
self ffiCall: #( void cpBodySetPosition( self, cpVect vector ) ).
I`m not getting any "error" but the position is not updating. I tried the same using Chipmunk directly and it works, so there is a problem with what i have in Pharo.
A general approach might be to write your own C wrapper around Chipmunk library functions which just does a debug printout of parameters before calling the wrapped function. Use these for both from Pharo and your "direct" trial, and see how they compare.
cheers -ben
On Mon, Sep 18, 2017 at 12:01 AM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Pierce: I already see the repo, i kwnow now the difference and is not the problem i have now. I made the suggestion for book draft i found, because theres is no example on it. Thanks for answer.
Stephan : Yes, as Esteban said i´m using that, I´m extending (or trying) Esteban´s project. And i´m having the problem that esteban metioned. Thanks for answer.
Ben: I have in C the same example as in Pharo using the physics of Chipmunk, and in C is working fine, there is a problem in the call to the function from Pharo in 64 bits. Thanks for answer.
Replicating the same example in C was not my point. You'd said you'd already done that ;) I meant compile your own shared C library containing... cpBody* myBodyNew(cpFloat m, cpFloat i)) { printf( "....\n", m, i ); cpBodyNew(cpFloat m, cpFloat i); } and from Smalltalk use... self ffiCall: #(cpBody* myBodyNew(cpFloat m, cpFloat i)) also changing your existing C example to also use myBodyNew() to confirm it works as expected. cheers -ben
2017-09-17 12:11 GMT-03:00 Ben Coman <btc@openinworld.com>:
On Fri, Sep 15, 2017 at 9:42 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi everybody, i´m using UnifiedFFI with Chipmunk2D library . I want to get a pointer to a C Structure (cpBody) and set a position to it. I have a subClass of FFIOpaqueObject to handle pointer.
This is the "new " ffiCall : self ffiCall: #(cpBody* cpBodyNew(cpFloat m, cpFloat i))
And this is a "seter" ffiCall:
self ffiCall: #( void cpBodySetPosition( self, cpVect vector ) ).
I`m not getting any "error" but the position is not updating. I tried the same using Chipmunk directly and it works, so there is a problem with what i have in Pharo.
A general approach might be to write your own C wrapper around Chipmunk library functions which just does a debug printout of parameters before calling the wrapped function. Use these for both from Pharo and your "direct" trial, and see how they compare.
cheers -ben
Thanks Ben, i `ll try that. Should "printf" print something on console while calling function form pharo or is only to check from C example? 2017-09-17 14:12 GMT-03:00 Ben Coman <btc@openinworld.com>:
On Mon, Sep 18, 2017 at 12:01 AM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Pierce: I already see the repo, i kwnow now the difference and is not the problem i have now. I made the suggestion for book draft i found, because theres is no example on it. Thanks for answer.
Stephan : Yes, as Esteban said i´m using that, I´m extending (or trying) Esteban´s project. And i´m having the problem that esteban metioned. Thanks for answer.
Ben: I have in C the same example as in Pharo using the physics of Chipmunk, and in C is working fine, there is a problem in the call to the function from Pharo in 64 bits. Thanks for answer.
Replicating the same example in C was not my point. You'd said you'd already done that ;)
I meant compile your own shared C library containing... cpBody* myBodyNew(cpFloat m, cpFloat i)) { printf( "....\n", m, i ); cpBodyNew(cpFloat m, cpFloat i); }
and from Smalltalk use... self ffiCall: #(cpBody* myBodyNew(cpFloat m, cpFloat i))
also changing your existing C example to also use myBodyNew() to confirm it works as expected.
cheers -ben
2017-09-17 12:11 GMT-03:00 Ben Coman <btc@openinworld.com>:
On Fri, Sep 15, 2017 at 9:42 PM, alvaro piorno <
alvaropiorno100@gmail.com>
wrote:
Hi everybody, i´m using UnifiedFFI with Chipmunk2D library . I want to get a pointer to a C Structure (cpBody) and set a position to it. I have a subClass of FFIOpaqueObject to handle pointer.
This is the "new " ffiCall : self ffiCall: #(cpBody* cpBodyNew(cpFloat m, cpFloat i))
And this is a "seter" ffiCall:
self ffiCall: #( void cpBodySetPosition( self, cpVect vector ) ).
I`m not getting any "error" but the position is not updating. I tried the same using Chipmunk directly and it works, so there is a problem with what i have in Pharo.
A general approach might be to write your own C wrapper around Chipmunk library functions which just does a debug printout of parameters before calling the wrapped function. Use these for both from Pharo and your "direct" trial, and see how they compare.
cheers -ben
Calling the wrapper function from Pharo the printf "should" output to the console (at least on Unix platforms). Shout if it doesn't. cheers -ben On Mon, Sep 18, 2017 at 9:41 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Thanks Ben, i `ll try that. Should "printf" print something on console while calling function form pharo or is only to check from C example?
2017-09-17 14:12 GMT-03:00 Ben Coman <btc@openinworld.com>:
On Mon, Sep 18, 2017 at 12:01 AM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Pierce: I already see the repo, i kwnow now the difference and is not the problem i have now. I made the suggestion for book draft i found, because theres is no example on it. Thanks for answer.
Stephan : Yes, as Esteban said i´m using that, I´m extending (or trying) Esteban´s project. And i´m having the problem that esteban metioned. Thanks for answer.
Ben: I have in C the same example as in Pharo using the physics of Chipmunk, and in C is working fine, there is a problem in the call to the function from Pharo in 64 bits. Thanks for answer.
Replicating the same example in C was not my point. You'd said you'd already done that ;)
I meant compile your own shared C library containing... cpBody* myBodyNew(cpFloat m, cpFloat i)) { printf( "....\n", m, i ); cpBodyNew(cpFloat m, cpFloat i); }
and from Smalltalk use... self ffiCall: #(cpBody* myBodyNew(cpFloat m, cpFloat i))
also changing your existing C example to also use myBodyNew() to confirm it works as expected.
cheers -ben
2017-09-17 12:11 GMT-03:00 Ben Coman <btc@openinworld.com>:
On Fri, Sep 15, 2017 at 9:42 PM, alvaro piorno <alvaropiorno100@gmail.com> wrote:
Hi everybody, i´m using UnifiedFFI with Chipmunk2D library . I want to get a pointer to a C Structure (cpBody) and set a position to it. I have a subClass of FFIOpaqueObject to handle pointer.
This is the "new " ffiCall : self ffiCall: #(cpBody* cpBodyNew(cpFloat m, cpFloat i))
And this is a "seter" ffiCall:
self ffiCall: #( void cpBodySetPosition( self, cpVect vector ) ).
I`m not getting any "error" but the position is not updating. I tried the same using Chipmunk directly and it works, so there is a problem with what i have in Pharo.
A general approach might be to write your own C wrapper around Chipmunk library functions which just does a debug printout of parameters before calling the wrapped function. Use these for both from Pharo and your "direct" trial, and see how they compare.
cheers -ben
participants (5)
-
alvaro piorno -
Ben Coman -
Esteban Lorenzano -
Pierce Ng -
Stephane Ducasse