Corona Win32 apps supports plugins now via the newest daily builds. We haven’t announced it yet, but we were planning on doing so next week.
First, any Win32 plugins available to the Windows version of the Corona Simulator will automatically be included in the Win32 app build. For example, this includes the OpenSSL, Zip, and Bit plugins. This also includes pure Lua based plugins as well, but I don’t think we have any on the plugin store yet (the intent was to distribute shader plugins in this fashion). Also, please note that the existing zip plugin has Win32 Unicode path issues, which turns out to be an issue with the 3rd party open source zlib library that it’s currently using. That might be a deal breaker for you.
Regarding making your own Win32 plugins, while we don’t have any official documentation for it *yet*, it is absolutely possible to create them now. The newest daily build of Corona Enterprise provides the Win32 *.lib files and *.h header files you need.
And the header files can be found under…
CoronaEnterprise\Corona\shared\include
You can find the *.lib files under…
CoronaEnterprise\Corona\win\lib
You’ll need Visual Studio 2013 to create your plugin DLL. I recommend using the free Community Edition provided that your organization meets its terms (ie: for example, it’s not free for organization that make more than $1 million in revenue). You’ll need to do the following to create your plugin:
- In Visual Studio, select “File\New” from the menu.
- Select “Installed\Visual C++\Win32” in the tree on the left of the “New Project” window.
- Select “Win32 Project” from the list in the middle.
- For the “Name” field, enter a name such as “plugin.<YourLibraryName>”. Note that when you “require” in your library in Lua, it’ll use this name.
- After creating the project, right click on your project node in the “Solution Explorer” panel.
- Select “Properties” from the popup menu. (This part forward requires substantial knowledge of how to use VC++.)
- Under “Linker\Input” add a dependency to “CoronaEnterprise\Corona\win\lib\CoronaLabs.Corona.Native.lib”. (This library is needed for the Corona C APIs. It’s up to you to set a good relative path.)
- Under “Linker\Input” add a dependency to “CoronaEnterprise\Corona\win\lib\lua.lib”. (This library provides the standard Lua C APIs. It’s up to you to set a good relative path.)
- Under “C/C++\General” add an “Additional Include Directories” path to “CoronaEnterprise\Corona\shared\include\Corona”. (This provides access to Corona C APIs. It’s up to you to set a good relative path.)
- Under “C/C++\General” add an “Additional Include Directories” path to “CoronaEnterprise\Corona\shared\include\lua”. (This provides access to Lua’s C APIs. It’s up to you to set a good relative path.)
- Under “General”, make sure to select “Platform Toolset” option “Visual Studio 2013 - Windows XP (v120_xp)”. This allows your plugin to run under Windows XP, if you still wish to support that platform. Otherwise, your plugin can only be loaded on Windows Vista or newer OS versions.
The standard Lua library (not made by Corona Labs) has built-in support for loading DLLs via the Lua require() function. It’s documented on the www.lua.org website. But here’s a quick summary. Your DLL needs to export a C function like this…
extern "C" \_\_declspec(dllexport) int luaopen\_plugin\_\<YourPluginName\>(lua\_State\* L)
You can find an example on how this works via the link below. It’s our “bit” plugin that we’ve open sourced on gihub.
https://github.com/coronalabs/plugins-source-bit
There’s just one more thing to note. We current haven’t made our Win32 specific C APIs public yet since that’s still in flux at the moment. But we do plan on opening it up in the near future (no specific date yet). If your plugin needs access to the main window’s HWND and Window messages, and I suspect it does, then a simple solution to this would be to get a hold of the main window’s HWND via Microsoft’s GetActiveWindow() C function. That’s a safe assumption to make for a Win32 built app (but not a safe assumption in the Corona Simulator).
https://msdn.microsoft.com/en-us/library/windows/desktop/ms646292(v=vs.85).aspx
Also, when you set your WindowProc callback to capture IME messages in your plugin, make sure to maintain the WindowProc *chain* by passing any messages your plugin doesn’t handle to the previously set WindowProc callback (which would be Corona in this case). Otherwise, your plugin will steal messages from the app, preventing Corona from receiving key and mouse message/events, and worse, the close message/event which allows the [x] button to close the app.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms644898(v=vs.85).aspx
Edit: Final note. Your compiled plugin DLL and all of its DLL dependencies (if any) will need to be copied to your app’s root directory, where your *.exe all of Corona’s DLLs are located.
I hope this helps!