# calling C/C++ from a Lua-based plugin



## music guy (Jun 3, 2008)

So I got the Export SDK, and I'm playing around with it.

I've read the stuff online about how to call C/C++ from Lua, but I don't think I have the big picture here yet.

I see how to write the code so Lua can use it.  I see how to call it from Lua.

But what I don't get is how to tell Lua about a library I have that I want it to call?  I assume the .lib needs to be in the folder with all the .lua files, but how do I tell it that it can find those calls in there?

Thanks in advance...


----------



## Sean McCormack (Jun 4, 2008)

Seriously? There's a Lua C bridge, but I know nada about it, but these guys do: 

http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=72&catid=664&entercat=y


----------



## music guy (Jun 4, 2008)

Actually, section 26.2 of the Lua docs explains this, but I'm beginning to think that the LR Lua interpreter doesn't allow dynamic loading.


----------



## music guy (Jun 5, 2008)

In case anyone else is trying this, I seem to have confirmed that LR doesn't allow dynamic binding.  I have my lib working from the standalone Lua interpreter, but my plugin won't load in LR with it.

I got an idea from looking at LRMogrify, though - I can make my lib be an 
executable, and call it from LrTasks.execute.  It's a little less slick (esp. for passing arguments), but I think it should work for what I need.


----------

