How to link a C++ function to my Codea project

Hi, could anyone give me a tip on how to call from my my exported Codea project a function written in C++?

In 2 weeks (when break starts) I’m starting a book on how to integrate C/Obj-C (which would be easy to adapt to C++) with Codea in the runtime. So sit tight, and you’ll get a tutorial. You can also learn by example by looking at my thread on Objective C add ons (it’s a bit barried in my discussions).
Thanks!

Thanks @Zoyt, you are the man!!! I look forward to seeing the tutorials :slight_smile:

@Zoyt looking forward to it.

@reefwing had several examples and tutorials on adding obj-C features to the runtime. If you’re looking for something “standard” (like adding Game Center) he may have you covered.

@Mark @Briarfox, @Zoyt:
I am looking more into linking to my own mathematical libraries. For example, I am interested in measures of stress and deformation on a given mesh. The mesh has “N” triangles and “n” nodes. The nodes in the mesh have coordinates (x,y) and to each node I associate a displacement (u,v). So I need to pass my function a table with triangle connectivities {{i1 j1 k1} {i2 j2 k2} … {iN jN kN}}, another table with node coordinates {{x1 y1} {x2 y2} … {xn yn}} and another table with nodal displacements {{u1 v1} {u2 v2} … {un vn}}. My function will operate on that data and return another table with some measure of deformation or even a measure of stress for each triangle. These calculations are very expensive so I think the only good option is to do them in C++, plus I already have the code for that. So the only thing I need to know is how tables are passed as argument to C++ functions, and how to link them into my Codea exported project.

woa, you can integrate objective c into the runtime? That sounds like the magic dreams are made of. Sounds neat!

@Mark - I’ve found that my libaries enable you to define all the parameters in Lua, while with reefewigs, you have to define things like your leaderboard ids in the C code. That being said, I learned a lot from his tutorials.
@MoNuS - Tables are moderately complicated (since it runs on a stack, but it’s hard to visualize the stack, but I’ll get into that), especially multidimensional ones. I’ll look into covering it, but no promises.
Thanks!

Thanks again, @Zoyt! I’ll look forward to reading your tutorials, I’m already a big fan!