av_register_all generates an exception in Release mode on Windows [closed]-Collection of common programming errors

I have a program that uses libav. It works well when compiled in Debug mode (Windows, VisualStudio 2010). However, when the program is compiled in Release mode, it crashes in av_register_all. The exception I get is Privileged Instruction.

Anyone has an idea if there is anything special that needs to be done in Release mode to get libav to work?

Best regards Ran