March 18, 2012
I have a program which I could not compile with dmc because  a windows service interface was added. I could solve it by fetching winsvc.h from mingw.
The result was that I had files from 2 distrubutions and they are from different versions.
I tried ms sdk 7.1 but that caused a lot of grief and with files in the thousends
I deceided to go with win32api from mingw.org. I enclose the recepy in the hope it is a)useful for someone b) maybe someone can improve on it.

I looked at kernel32.def on dsource.org and modeled the defs after that.
implib didn't like the keyword DATA so I left them out! Maybe someone knows how to apply that.
Also gcc has pragma aux and offcourse dmc complains. I didn't plan on editing the header files, more then neccesary. Again maybe someone can come up with an, automated, strategy.

Rene.




start cmd.exe menu-->run type cmd
mkdir c:\sdk
mkdir c:\dm\def
mkdir c:\dm\def\ddk
mkdir c:\dm\lib\ddk
mkdir c:\dm\def\directx
mkdir c:\dm\lib\directx

Start you browser and Download in c:\sdk http://gnuwin32.sourceforge.net/packages/gawk.htm http://sourceforge.net/projects/mingw/files/MinGW/Base/w32api/w32api-3.17/ http://downloads.sourceforge.net/sevenzip/7z920.exe http://cmeerw.org/file/dm/rm-win32.bat

execute 7z920.exe and start win zip. Go, in 7-zip, to c:\sdk

rightclick on w32api-3.17-2-mingw32-src.tar.lzma 7-zip-->extract here rightclick on w32api-3.17-2-mingw32-src.tar      7-zip-->extract here rightclick on gawk-3.1.6-1-bin.zip               7-zip-->extract here

goto w32api-3.17-2-mingw32\include

edit windef.h
	around line 120 You see:
	#define DECLSPEC_IMPORT __declspec(dllimport)
	#define DECLSPEC_EXPORT __declspec(dllexport)
	#ifdef __GNUC__
	#define DECLSPEC_NORETURN __declspec(noreturn)
	#define DECLARE_STDCALL_P( type ) __stdcall type
	#elif defined(__WATCOMC__)
	#define DECLSPEC_NORETURN
	#define DECLARE_STDCALL_P( type ) type __stdcall

	change the elif line( around 125) to:
	#elif defined(__WATCOMC__) || defined(__DMC__)
and save.

in command.com window do
cd \dm
\sdk\rm-win32.bat

in 7-zip:
copy the whole include directory to c:\dm\


save the awk program below to c:\sdk\def.awk
----------------------------Begin-def.awk----------------------
$1 ~ /LIBRARY/ { lib = gensub(/['"]/,"","g",$2)
	next}
/EXPORTS/ {next}
/^;/{next }
/^[ 	]*$/{next }

$2 ~ /DATA/{next}
{function_name[i++] = $1 }
END{
	print "LIBRARY '" lib "'"
	print "EXETYPE NT"
	print "	SUBSYSTEM WINDOWS"
	print "EXPORTS"
	for(k =0; k < i ;k++){
		number_of_parts = split(function_name[k],parts,"@")
		if( 2 == number_of_parts){
			print "_" parts[1] "@" parts[2] " = " parts[1]
		}else if (1 == number_of_parts){
			print parts[1]
		}else {
		print "Odd this function has 0 or 3 or more parts " function_name[k]
		}
	}
}
----------------------------End---def.awk----------------------

cd \sdk\w32api-3.17-2-mingw32\lib
for %i in (*.def) do \sdk\bin\awk.exe -f \sdk\def.awk %i > \dm\def\%i

cd ddk
for %i in (*.def) do \sdk\bin\awk.exe -f \sdk\def.awk %i > \dm\def\ddk\%i
cd ..\directx
for %i in (*.def) do \sdk\bin\awk.exe -f \sdk\def.awk %i > \dm\def\directx\%i

cd \dm\def

for %i in (*.def) do \dm\bin\implib.exe /noi \dm\lib\%~ni.lib %i
cd ddk
for %i in (*.def) do \dm\bin\implib.exe /noi \dm\lib\ddk\%~ni.lib %i
cd ..\directx
for %i in (*.def) do \dm\bin\implib.exe /noi \dm\lib\directx\%~ni.lib %i

cd \sdk\w32api-3.17-2-mingw32\lib
for %i in (*uuid.c) do \dm\bin\dmc -c %i
dir /B  *uuid.obj >uuid-lib.bat

edit uuid-lib.bat.
put at the begin \dm\bin\lib -c uuid.lib
and put all the object filenames behind it
write and quit

uuid-lib.bat
copy uuid.lib \dm\lib\

\dm\bin\dmc -c shell32.c  gdiplus.c
\dm\bin\lib \dm\lib\shell32.lib shell32.obj
\dm\bin\lib \dm\lib\gdiplus.lib gdiplus.obj

I'm not sure how important the other c files are!

and that should do it! You can  now remove c:\sdk