I need to use some functions from the Win32 Crypto API, such as CryptQueryObject. The problem is that I also need to compile my program with MingW and the crypto library included is missing some of the functions that I need, like the aformentioned CryptQueryObject. I tried copying the relevant C header definitions, so that the program now compiles, but at link time it fails with undefined reference errors (since mingw’s crypt32.dll doesn’t implement some functions). I tried linking against C:\Windows\System32\crypt32.dll, but it still returns linking errors.
Is there a way to use the entire Crypto API in mingw?
You need to dynamically link to crypt32.dll. You can either do this at runtime
using Win32 API functions LoadLibrary + GetProcAddress, or at compile time using an import library.
For runtime binding, MSDN has a good example.
EDIT: If you need a bunch of API functions not present in MinGW’s headers, go for the import library.