The declaration should be cdecl, not stdcall.It is perfectly normal for Lame to sometimes return 0 output bytes. It just means that it needs more data before returning any compressed data.But your local variables beeing destroyed is not normal.
The declaration should be cdecl, not stdcall.
I guess the mapping of the normal/extreme/insane presets to the BE_CONFIG struct are a well kept secret?
etree users would also appretiate FLAC support (using libFLAC).