matwachich Posted September 23, 2012 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!
jaberwacky Posted September 23, 2012 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: AutoIt Wiki | Can't find what you're looking for on the Forum? My scripts: Guiscape | Baroque AU3 Code Formatter | MouseHoverCalltips | SciTe Customization GUI | ActiveWindowTrack Toy | Monitor Configuration UDF
matwachich Posted September 24, 2012 Author Posted September 24, 2012 Thanks for the answer! It is the probleme: DllCallBackRegister can't handle structs. So, is there any other trick???
Moderators SmOke_N Posted September 24, 2012 Moderators 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.
matwachich Posted September 24, 2012 Author 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
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