0

I build a 'abc.dll', which is dependent on some other dll.

add_library(
    abc
    SHARED 
    mycode.cpp
)

target_link_libraries(
 abc
 avutil-57
 avformat-59
)

Then I run flutter build windows -v to build the project, and in Release folder (build\windows\runner\Release), I can start the application successfully.

But if I run the application in debug mode, I encounter the error: Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'abc.dll': error code 193

I compared the dll files between release and debug folder, the abc.dll is different because of compiled in debug/release version. The reset depedent dll files are the same.

Is it because the abc.dll is compiled in debug mode but the depedent dll files are prebuild in release mode?

Richard Heap
  • 48,344
  • 9
  • 130
  • 112
John
  • 697
  • 1
  • 10
  • 33
  • If you are on Windows, don't mix debug and release builds. – Jesper Juhl Oct 12 '22 at 15:22
  • @JesperJuhl thanks, but then how do I debug? The dependent DLL files are prebuilt. – John Oct 12 '22 at 15:29
  • It is possible to debug optimized code - it's just a lot harder (and often confusing). Maybe ask the provider of the other DLL for a debug version or just the source code..? – Jesper Juhl Oct 12 '22 at 15:33
  • It’s ffmpeg, so the code is there, but very hard to build a debug version. Maybe I develop on linux or Mac first. – John Oct 12 '22 at 15:36
  • 1
    Ffmpeg can be built on Windows just fine. What's the problem with doing a debug build? In fact, I would say; when you have sources available, why would you *ever* rely on pre-built libraries rather than building them from the source with the same compiler (and optimization/debug options) as the rest of your app?? – Jesper Juhl Oct 12 '22 at 15:37
  • @JesperJuhl thanks for reply. The prebuild is not done by me, i am using this prebuilt libraries: https://github.com/bytedeco/javacv. Agree that i can build everying from source, but need take much more effort to build in my local. – John Oct 12 '22 at 23:42

0 Answers0