How to use external Dll in Air Native Extension?
Asked Answered
R

2

6

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?

Rounded answered 22/3, 2012 at 13:43 Comment(0)
R
7

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.

Riehl answered 7/3, 2013 at 6:24 Comment(1)
Instead of copying, you could include the directory which contains the dll in your %PATH%. See for example my run script. Not sure if that's possible in Flash Builder though.Athome
I
0

If your dll is using other dlls then include the reference dll's in the project where you are going to use that ANE file.

Internationalist answered 17/4, 2012 at 10:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.