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:-
The following commands would produce the following files called glib.defCode:/* 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
Code:cl /EP glib.symbols > glib.def produces this in glib.def:- g_mkdir_with_parentsSo 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: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
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.Code:<UserMacro Name="GlibGenerateGlibDef" Value="echo >"$(SolutionDir)\glib.def" && cl /EP -DG_OS_WIN32 glib.symbols >>"$(SolutionDir)\glib.def"" />
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:-
but that didn't work eitherCode:Name="GlibGenerateGlibDef" Value="echo EXPORTS >"$(SolutionDir)\glib.def" && cl /EP -DG_OS_WIN32 glib.symbolsI feel sure there must be a way to do this.


I feel sure there must be a way to do this.
Reply With Quote
Bookmarks