COM via luacom

Hello there,

I’ve been trying to use the luacom plugin in Win32.

Interestingly enough, executing my Corona project from the simulator via ZeroBrane studio (my tool of choice), it works great, and I can access any COM object in my computer.

If however I execute the project directly from the sImulator, or after building it for Win32, I get a Corona runtime error: “error loading module luacom from c:…luacom.dll. The specified module cannot be found:” (nothing more informative)

Is this something worth pursuing? (I’m really interested, but…)

With the current situation of Corona - being open source, but then marketplace and hosted plugins, even more, corona native for iOS and Android (but not Win32)… 

Thanks!

I’m not familiar with that plugin, but I believe, you need to put the .dll file in the same folder with your main.lua.

Rob

Hi Rob - thanks for the quick reply!

I tried that, actually tried every combination.

It works if the simulator is executed from Zerobrane (dll placed in the project folder), it does not if standalone or if the project is built.

If you don’t see any reason for this to fail to work, I’ll keep trying - any ideas most welcome :slight_smile:

All I get is this: http://lunatico.es/tmp/luacom.PNG

Hello!

So, if you want your plugin to be used in Simulatory you should place dll inside “%AppData%\Corona Labs\Corona Simulator\Plugins”.

If you want your Windows built app to use a plugin, DLL should be near the built app exe file.

Problem you have on screenshot is different kind: your DLL is failed to load for some reason (not that file was not found). Basically, module “luacom” could not be loaded from “plugin_luacom.dll”.

In most cases it means that your plugin_luacom.dll relies on some other DLLs which should be placed near your built windows app.

Thanks Vlad,

the plugin is not “mine”, is one publicly available since a lot of years: http://luaforge.net/projects/luacom/

I’ll check the source code and see what I can find out. What puzzled me was the fact it ran perfectly from Zerobrane - still puzzled  :stuck_out_tongue:

I’ll report back here.

Ok, it was not so hard.

I recompiled luacom on my VS Community 2017, taking some header files and lua.lib from the Corona distribution.

Challenge has been to “bin2c” a lua file to a C file (never did this before, but went smooth).

Now it works like a charm, I can access any COM object from within my Corona application. Really happy!  :smiley:

If anyone is interested, the dll is available from http://lunatico.es/dev/luacom.dll

Documentation, etc: http://lua-users.org/wiki/LuaCom

I’m not familiar with that plugin, but I believe, you need to put the .dll file in the same folder with your main.lua.

Rob

Hi Rob - thanks for the quick reply!

I tried that, actually tried every combination.

It works if the simulator is executed from Zerobrane (dll placed in the project folder), it does not if standalone or if the project is built.

If you don’t see any reason for this to fail to work, I’ll keep trying - any ideas most welcome :slight_smile:

All I get is this: http://lunatico.es/tmp/luacom.PNG

Hello!

So, if you want your plugin to be used in Simulatory you should place dll inside “%AppData%\Corona Labs\Corona Simulator\Plugins”.

If you want your Windows built app to use a plugin, DLL should be near the built app exe file.

Problem you have on screenshot is different kind: your DLL is failed to load for some reason (not that file was not found). Basically, module “luacom” could not be loaded from “plugin_luacom.dll”.

In most cases it means that your plugin_luacom.dll relies on some other DLLs which should be placed near your built windows app.

Thanks Vlad,

the plugin is not “mine”, is one publicly available since a lot of years: http://luaforge.net/projects/luacom/

I’ll check the source code and see what I can find out. What puzzled me was the fact it ran perfectly from Zerobrane - still puzzled  :stuck_out_tongue:

I’ll report back here.

Ok, it was not so hard.

I recompiled luacom on my VS Community 2017, taking some header files and lua.lib from the Corona distribution.

Challenge has been to “bin2c” a lua file to a C file (never did this before, but went smooth).

Now it works like a charm, I can access any COM object from within my Corona application. Really happy!  :smiley:

If anyone is interested, the dll is available from http://lunatico.es/dev/luacom.dll

Documentation, etc: http://lua-users.org/wiki/LuaCom