Skip to main content
Inspiring
October 30, 2013
Answered

Native extension Error #3500: after linking with certain .lib file

  • October 30, 2013
  • 1 reply
  • 1371 views

Hi there,


I'm building my second native extension and ran into a strange issue. THe first native extension I built was purely build from source(no external libs), no problems there at all. So with this second one I'm using ffmpeg. I'm trying to build a version for Windows(again), meaning I've got the 32bit libs from zeranoe.com. I've got the include files, .lib files and .dll's. I've pretty much cloned my previous project which worked well, so I have the .bat files to build the ane. descriptor .xml etc.

So I built the .ane as before, included it into my project and... got this:

ArgumentError: Error #3500: The extension context does not have a method with the name fw_ffmpeg_create.

I've been googling and checking everything, but I saw no problem anywhere(it's definitely not Flash Builder 4.6 bug, I'm not using that). I concluded it must be something with the .dll, so I started to take away the "extra" stuff from the .dll, because I knew my previous simple .ane worked. I took away my code refering ffmpeg until I took it all away, so I was left with empty class methods. Rebuilt ane, and no complains!

So I've re-added av_free() for fun (one of ffmpegs functions), to cause linking hopefully and there it is again, Error: #3500 blabla.

What's going on? Is some corruption taking place caused by linking in the ffmpegs? I have tried to compile the ane .dll in VS2012 and VS2013, same result. The test app is using Flash CS6 (even I'm now going to try using IntelliJ). Just curious if someone saw this before that an external lib could corrupt native extension in such a way. Maybe there's a compile setting to prevent that, not sure.

This topic has been closed for replies.
Correct answer _falcan0

Replying to myself:

After debugging AIR in disassembler (yes), I found out that the error message stems from the fact that a dll failed to load. I was getting 0XC0000135 return code from ldrLoadDll deep inside AIR. I was not getting it, since my ffmpeg dll's were in the app projects folder(and when they were missing the app complained, after I copied them over it didn't). Then I realized that might not be enough strangely, so I tried to copy them over to system32 as well - and of course, #3500 disappeared. I guess in the end the .dll's need to be somewhere else, but too tired to find out now.

So the thing is - even if AIR says your function isn't defined in the native extension (error #3500), that error might not be describing the real issue. If your native extension dll fails to load for some reason it fails to load the ExtensionInitializer which fails to execute ContextInitializer, so your function names are not available to AIR.

I still have other unrelated issues with my ANE now(crashes), but it seems to be interacting with ffmpeg .dll's finally. Oh well, at least I learned new stuff during those 2 days.

1 reply

_falcan0AuthorCorrect answer
Inspiring
November 1, 2013

Replying to myself:

After debugging AIR in disassembler (yes), I found out that the error message stems from the fact that a dll failed to load. I was getting 0XC0000135 return code from ldrLoadDll deep inside AIR. I was not getting it, since my ffmpeg dll's were in the app projects folder(and when they were missing the app complained, after I copied them over it didn't). Then I realized that might not be enough strangely, so I tried to copy them over to system32 as well - and of course, #3500 disappeared. I guess in the end the .dll's need to be somewhere else, but too tired to find out now.

So the thing is - even if AIR says your function isn't defined in the native extension (error #3500), that error might not be describing the real issue. If your native extension dll fails to load for some reason it fails to load the ExtensionInitializer which fails to execute ContextInitializer, so your function names are not available to AIR.

I still have other unrelated issues with my ANE now(crashes), but it seems to be interacting with ffmpeg .dll's finally. Oh well, at least I learned new stuff during those 2 days.