matwachich Posted September 23, 2012 Share Posted September 23, 2012 Hi every body! I'm actually trying to make a wrapper for Chipmunk Physics library, it's an OpenSource 2D rigide bodies physics library, and I have a problem: There is a callback function passing a structure (cpVect), and I don't know if there is a trick to be able to use it. Here is the declaration of the callback ;~ typedef void(* cpSpaceNearestPointQueryFunc )(cpShape *shape, cpFloat distance, cpVect point, void *data) ;~ Nearest point query callback function type. Thanks! Link to comment Share on other sites More sharing options...
jaberwacky Posted September 23, 2012 Share Posted September 23, 2012 (edited) I think you'll need DllCallBackRegister but I'm not entirely sure. Edit: I just read that DllCallBackRegister can't handle structs. Sorries. Edited September 23, 2012 by LaCastiglione Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
matwachich Posted September 24, 2012 Author Share Posted September 24, 2012 Thanks for the answer! It is the probleme: DllCallBackRegister can't handle structs. So, is there any other trick??? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 24, 2012 Moderators Share Posted September 24, 2012 Did you try using a ptr and pulling the data out from that? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
matwachich Posted September 24, 2012 Author Share Posted September 24, 2012 (edited) No, didn't tried yet. I will try this, and I had another idea, gonna tell you if it works: Knowing that a cpVect structure is "double x; double y", I will try this: ;~ typedef void(* cpSpaceNearestPointQueryFunc )(cpShape *shape, cpFloat distance, cpVect point, void *data) DllCallbackRegister("none:cdecl", "ptr;double;double;double;int", "_Function") gonna see! PS: I have not tried yet cause I didn't wrapped enough functions yet to be able to run a test Edited September 24, 2012 by matwachich Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now