Author Topic: dwmapi.h, Vista GLASS and MingW compiler?  (Read 11150 times)

Offline Szabadember

  • Multiple posting newcomer
  • *
  • Posts: 75
  • That's me!
dwmapi.h, Vista GLASS and MingW compiler?
« on: May 24, 2007, 11:20:55 am »
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.
« Last Edit: May 24, 2007, 11:58:23 am by Szabadember »

Offline Szabadember

  • Multiple posting newcomer
  • *
  • Posts: 75
  • That's me!
Re: dwmapi.h, Vista GLASS and MingW compiler?
« Reply #1 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)

wxLearner

  • Guest
Re: dwmapi.h, Vista GLASS and MingW compiler?
« Reply #2 on: May 24, 2007, 09:42:27 pm »
I've already solved it, i used LoadLibrary() to import "dwmapi.dll" and wrote my own header.
I'm soooooooo smart!!!  :lol: 8)
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.

Offline iw2nhl

  • Multiple posting newcomer
  • *
  • Posts: 116
  • BASIC, C, C++, Qt, bash
Re: dwmapi.h, Vista GLASS and MingW compiler?
« Reply #3 on: May 24, 2007, 11:29:17 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.
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

  • Guest
Re: dwmapi.h, Vista GLASS and MingW compiler?
« Reply #4 on: May 25, 2007, 02:16:55 pm »
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
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.
« Last Edit: May 25, 2007, 02:23:20 pm by wxLearner »

Offline iw2nhl

  • Multiple posting newcomer
  • *
  • Posts: 116
  • BASIC, C, C++, Qt, bash
Re: dwmapi.h, Vista GLASS and MingW compiler?
« Reply #5 on: May 25, 2007, 02:56:24 pm »
Thank you very much to everyone for the infos!

I'll try with that tools of MinGW, I din't know it was possible...