From 66acd6d00fc0f79bd2a53981bbff8a55648f12bb Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 12 Aug 2011 00:48:39 +0000 Subject: [PATCH] 2011-08-12 02:46 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * package/winuni/mpkg_win_uni.bat ! added workaround for what it seems like a BCC IMPLIB tool bug (met in the past a few times already), where IMPLIB will forget to add leading underscore for certain symbols, leading to unexplained "unresolved external" errors when trying hbmk2 with -shared option with BCC. The bug is present in BCC 5.5 and BCC 5.8, no newer versions tested. The workaround is to convert to .def file first using IMPDEF, then correct the .def to avoid an IMPLIB pitfall, where it cannot handle '-' char in library name unless enclosed between double-quotes (but IMPDEF doesn't add those double quotes). [ So now winuni pkg builder script requires GNU SED tool.] Then the corrected .def file can be converted to .lib by IMPLIB correctly. [TOMERGE 3.0] --- harbour/ChangeLog | 17 +++++++++++++++++ harbour/package/winuni/mpkg_win_uni.bat | 15 ++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 459ddef69a..10a2d3a136 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,23 @@ The license applies to all entries newer than 2009-04-28. */ +2011-08-12 02:46 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * package/winuni/mpkg_win_uni.bat + ! added workaround for what it seems like a BCC IMPLIB tool + bug (met in the past a few times already), where IMPLIB + will forget to add leading underscore for certain symbols, + leading to unexplained "unresolved external" errors when + trying hbmk2 with -shared option with BCC. The bug is present + in BCC 5.5 and BCC 5.8, no newer versions tested. + The workaround is to convert to .def file first using IMPDEF, + then correct the .def to avoid an IMPLIB pitfall, where it + cannot handle '-' char in library name unless enclosed between + double-quotes (but IMPDEF doesn't add those double quotes). + [ So now winuni pkg builder script requires GNU SED tool.] + Then the corrected .def file can be converted to .lib by + IMPLIB correctly. + [TOMERGE 3.0] + 2011-08-12 02:37 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/hbwin.hbx * rebuilt after recently added symbols diff --git a/harbour/package/winuni/mpkg_win_uni.bat b/harbour/package/winuni/mpkg_win_uni.bat index e9d5d50e18..292d1b6065 100644 --- a/harbour/package/winuni/mpkg_win_uni.bat +++ b/harbour/package/winuni/mpkg_win_uni.bat @@ -13,6 +13,7 @@ rem - Adjust target dir, mingw dirs, set HB_DIR_UPX, HB_DIR_7Z, HB_DIR_MINGW, HB rem create required packages beforehand. rem - Requires BCC in PATH or HB_DIR_BCC_IMPLIB (for implib). rem - Run this from vanilla official source tree only. +rem - Requires GNU sed tool in PATH echo ! Self: %0 @@ -57,7 +58,19 @@ xcopy /y %~dp0..\..\pkg\win\mingw64\harbour-%HB_VF%-win-mingw64\bin\*.dll xcopy /y %~dp0..\..\pkg\wce\mingwarm\harbour-%HB_VF%-wce-mingwarm\bin\*.dll %HB_ABSROOT%bin\ rem ; Create special implibs for Borland (requires BCC in PATH) -for %%a in ( %HB_ABSROOT%bin\*-%HB_VS%.dll ) do "%HB_DIR_BCC_IMPLIB%implib.exe" -c -a %HB_ABSROOT%lib\win\bcc\%%~na-bcc.lib %%a +rem NOTE: Using intermediate .def files, because direct .dll to .lib conversion +rem is buggy in BCC55 and BCC58 (no other versions tested), leaving off +rem leading underscore from certain ("random") symbols, resulting in +rem unresolved externals, when trying to use. [vszakats] +for %%a in ( %HB_ABSROOT%bin\*-%HB_VS%.dll ) do ( + "%HB_DIR_BCC_IMPLIB%impdef.exe" -a "%HB_ABSROOT%lib\win\bcc\%%~na-bcc.defraw" "%%a" + echo s/LIBRARY %%~na.DLL/LIBRARY "%%~na.dll"/Ig> _hbtemp.sed + sed -f _hbtemp.sed < "%HB_ABSROOT%lib\win\bcc\%%~na-bcc.defraw" > "%HB_ABSROOT%lib\win\bcc\%%~na-bcc.def" + "%HB_DIR_BCC_IMPLIB%implib.exe" -c -a "%HB_ABSROOT%lib\win\bcc\%%~na-bcc.lib" "%HB_ABSROOT%lib\win\bcc\%%~na-bcc.def" + del "%HB_ABSROOT%lib\win\bcc\%%~na-bcc.defraw" + del "%HB_ABSROOT%lib\win\bcc\%%~na-bcc.def" +) +del _hbtemp.sed copy /y %~dp0..\..\pkg\win\mingw64\harbour-%HB_VF%-win-mingw64\bin\harbour.exe %HB_ABSROOT%bin\harbour-x64.exe copy /y %~dp0..\..\pkg\win\mingw64\harbour-%HB_VF%-win-mingw64\bin\hbformat.exe %HB_ABSROOT%bin\hbformat-x64.exe