User forums > General (but related to Code::Blocks)
dwmapi.h, Vista GLASS and MingW compiler?
Szabadember:
Hi everybody!
I would like to use the new DWMAPI(Desktop Window Manager API) introduced in windows Vista, but i don't want to change to another compiler. Is it possible to use the dwmapi with MingW or gcc? There's no dwmapi.h in the include folder of my MingW installation.
I also tried to use the VC compiler from the windows sdk but i get 284 Warnings although everything seems to work fine.
Szabadember:
I've already solved it, i used LoadLibrary() to import "dwmapi.dll" and wrote my own header.
I'm soooooooo smart!!! :lol: 8)
wxLearner:
--- Quote from: Szabadember on May 24, 2007, 06:08:18 pm ---I've already solved it, i used LoadLibrary() to import "dwmapi.dll" and wrote my own header.
I'm soooooooo smart!!! :lol: 8)
--- End quote ---
The Linux and MinGW linker ld can link to shared libraries directly (you don't need any import lib and you don't need the LoadLibrary/FreeLibrary and GetProcAddress APIs). If the dwmapi.dll exports C functions, it shouldn't be a problem.
iw2nhl:
--- Quote from: wxLearner on May 24, 2007, 09:42:27 pm ---The Linux and MinGW linker ld can link to shared libraries directly (you don't need any import lib and you don't need the LoadLibrary/FreeLibrary and GetProcAddress APIs). If the dwmapi.dll exports C functions, it shouldn't be a problem.
--- End quote ---
Are you sure? I tried to use a DLL, but MinGW linker could not use it: it always complained about unresolved functions.
(the compilation was fine because I had the ".h" files)
May be because the DLL was generated with VC++?
I needed to use the xerces-c lib (an XML parser) and I solved recompiling it with MinGW as a static lib (it generated a ".a" file which was good for MinGW).
Anyway if you know why it didn't work, please tell me! It would be nice to be able to use the DLL directly :-)
wxLearner:
If a dll exports C functions, ld can link them directly also, because no name mangling is used. xerces-c is a C++ library, or is there a C version also? C++ libraries, built by different compilers/linkers, mostly export different names. To avoid name mangling, a C bridge can be used:
--- Code: ---#ifdef __cplusplus
extern "C"
{
#endif
//no name mangling here
#ifdef __cplusplus
}
#endif
--- End code ---
If it's a VC dll, VC's import libs can be used by ld also. If you don't have VC's import lib, you can use pexports (which is included in mingw-utils), to create a .def file and then use dlltool to create a .a file (MinGW import lib). Take a look at the MinGW-FAQ also.
Navigation
[0] Message Index
[#] Next page
Go to full version