I followed MinGW faq and produced .a files from the dlls. Things seem to be fine.
> But I still cannot found any documentation on *_imp_* prefix. The faq does
> mention __stdcall prefix, but it is for msvc.

I gave you wrong / incomplete information. Using stdcall causes the @n to be
added to function names. __declspec(import), which tells the compiler that the
function is imported from a DLL, is what adds the __imp_ prefix.

See http://support.microsoft.com/kb/132044 for more information.

Alias John Brown.