## Using a VS macro to generate a .DEF file

I'm trying to build libglib using MSVC. libglib doesn't use dllexport - so to create usable DLLs it needs to generate a .DEF file. It does this by using a .symbols file. Here's a cut-down example:-

Code:
```/* This file lists all exported symbols. It is used to generate
* the glib.def file used to control exports on Windows.
*/

/* glib.symbols */
g_mkdir_with_parents

#ifdef G_OS_WIN32
g_file_get_contents_utf8
#endif```
The following commands would produce the following files called glib.def

Code:
```cl /EP glib.symbols > glib.def

produces this in glib.def:-

g_mkdir_with_parents```
Code:
```whereas this:-
cl /EP -DG_OS_WIN32 glib.symbols > glib.def

produces this in glib.def:-

g_mkdir_with_parents
g_file_get_contents_utf8```
So this is a handy way of producing conditional .DEF files. Fortunately, this can all be built into a Visual Studio macro in my vsprops file - e.g.

Code:
```	<UserMacro
Name="GlibGenerateGlibDef"
Value="echo &gt;&quot;\$(SolutionDir)\glib.def&quot; &amp;&amp; cl /EP -DG_OS_WIN32 glib.symbols &gt;&gt;&quot;\$(SolutionDir)\glib.def&quot;"
/>```
Problem:- Although I can run the macro as a pre-build step (and it does produce conditional entries in the generated .DEF file) it DOESN'T produce the word EXPORTS at the top of the file. So the linker then fails to recognise it as a valid .DEF file.

How can I add that word EXPORTS to the top of the generated file? I tried just adding EXPORTS to the top of the symbols file but that didn't work. I also tried this variation on the macro:-

Code:
```		Name="GlibGenerateGlibDef"
Value="echo EXPORTS &gt;&quot;\$(SolutionDir)\glib.def&quot; &amp;&amp; cl /EP -DG_OS_WIN32 glib.symbols```
but that didn't work either I feel sure there must be a way to do this.