masm32 (an assembler distribution that uses ms ml.exe, link.exe) gets around this by generating the .lib file on installation. they have .inc include headers which detail the symbols found in the windows system dlls and then a custom program generated .lib file using this information.
what you could do is include a mingw compiled sed program. then just create a batch file that accepts an dllname as an argument and generates the .lib file according to that exports_alt.sed script. just tell users to click on the script to generate the lib file for them and have it put the .lib file somewhere in the path for them.
So if you want to pursue this, grab sed.exe at:
http://prdownloads.sourceforge.net/gnuwin32/sed-4.1.4.exeHere's the exports_alt.sed script:
-----cut here---------
# echo LIBRARY msvcp71.dll > msvcprt.def
# echo EXPORTS >> msvcprt.def
# link -dump -exports msvcp71.dll | sed -nf exports_alt.sed >> msvcprt.def
# link -lib -machine:X86 -def:msvcprt.def -out:msvcprt.lib
#
/[ \t]*ordinal hint/,/^[ \t]*Summary/{
/^[ \t]\+[0-9]\+/{
s/^[ \t]\+[0-9]\+[ \t]\+[0-9A-Fa-f]\+[ \t]\+[0-9A-Fa-f]\+[ \t]\+\(.*\)/\1/p
}
}
-----cut here---------
Note the line endings in exports_alt.sed must be unix line endings (just LF, not CR/LF).
So either run dos2unix.exe on the file after cuting and pasting the above to a file, or use a text
editor which supports unix line endings (e.g. ultraedit).
Here's the dll2lib.bat batch script:
-----cut here---------
@echo off
REM call with dll2lib dll_basename lib_basename
REM e.g. dll2lib msvcp71 msvcprt
REM will look for msvcp71.dll in the current directory
REM and produce msvcprt.lib in the current directory
REM alt_exports.sed needs to be in the current directory
REM sed.exe (and libiconv2.dll, libintl3.dll) from gnuwin32 need to be in the PATH
set PATH="C:\Program Files\Microsoft Platform SDK\Bin\win64";%PATH%
echo LIBRARY %1.dll > %2.def
echo EXPORTS >> %2.def
link -dump -exports %1.dll | sed -nf exports_alt.sed >> %2.def
link -lib -machine:X86 -def:%2.def -out:%2.lib
-----cut here---------
This assumes you bundle sed.exe, the two lib files it needs (libiconv2.dll, libintl3.dll) which are in the same directory as sed.exe installs to, and that Platform SDK is installed on the user's machine. Then they just run
dll2lib msvcp71 msvcprt
to produce the msvcprt.lib file that's needed to link "Multi-threaded DLL Runtime Library".
---
Btw, I figure out the error message you were getting with _Xlen. This is a custom MS extension to the C++ library. The include files are in C:\Program Files\Microsoft Platform SDK\Include\crt
Specifically, see the file "xstring" in that dir. The dll which defines these functions is the microsoft runtime library (msvcrpt*.dll or msvcrt*.dll). So it is necessary to use the MS runtime for this. The standard C library doesn't look like it provides the crt extensions.