Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use external Dll in Air Native Extension?

The structure of my ANE file looks like this:

<META-INF>
    <ANE>
        <Windows-x86>
            ExtensionDll.dll
            DllUsedByExtensionDll.dll
        extension.xml
mimetype
catalog.xml
library.swf

If ExtensionDll.dll uses the functions in the other Dll, the extension won't load. DllMain is not called. It seems like DllUsedByExtensionDll.dll is not in the Dll search path when the air application uses the extension is running.

How should I make the application find the extra Dlls, if I don't want to put them into some common Dll path?

like image 392
BlueWanderer Avatar asked Mar 22 '12 13:03

BlueWanderer


1 Answers

I've had the same problem and went at this for a few days. Turns out there's two ways to solve this.

  1. Export Release Build, while making sure that the DllUsedByExtensionDll.dll is packaged in the same directory as your executable.
  2. For debugging purposes, copy the DllUsedByExtensionDll.dll into your Adobe AIR SDK bin directory, where the Air Debug Launcher (adl) executable is located.

You do not need to package DllUsedByExtensionDll.dll in the ANE that you are building.

The problem is that ExtensionDll.dll cannot find the DllUsedByExtensionDll.dll when it is launched from the debugger, since the executable for the debugger is located in the AIR SDK. Once you export the release build however, the your app is the executable, so now it looks for the dll in its root directory.

If you want to debug this in order to find out more information on what could be wrong, I suggest that you run your app by command line using the adl command.

For me, running through Flash Builder's debug/run meant that I could not see the Windows error "the program can't start because dll is missing from your computer". And that led me on a wild goose chase for a long time.

like image 149
blufiro Avatar answered Sep 22 '22 13:09

blufiro