# [PATCH 02/14] msvc: git-daemon.exe: Fix linker "unresolved externals" error

4 messages from 2010-12-04 to 2010-12-08. Participants: Ramsay Jones, Erik Faye-Lund.
Thread: https://gitlist.dev/t/25958

## Ramsay Jones, 2010-12-04 18:55

Subject: [PATCH 02/14] msvc: git-daemon.exe: Fix linker "unresolved externals" error
Message-ID: <4CFA8EB7.9070000@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/4CFA8EB7.9070000%40ramsay1.demon.co.uk

```

The msvc linker complains about external symbols referenced by
the new poll() emulation code. In particular, it complains about
the DispatchMessage(), PeekMessage(), TranslateMessage() and
MsgWaitForMultipleObjects() functions.

In order to satisfy the external references, we link against the
user32.lib library.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 1d42413..bda9fa6 100644
--- a/Makefile
+++ b/Makefile
@@ -1087,7 +1087,7 @@ ifeq ($(uname_S),Windows)
 	COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o compat/win32/pthread.o compat/win32/syslog.o compat/win32/sys/poll.o
 	COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/fnmatch -Icompat/regex -Icompat/fnmatch -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
 	BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
-	EXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib
+	EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib
 	PTHREAD_LIBS =
 	lib =
 ifndef DEBUG
-- 
1.7.3

```

## Erik Faye-Lund, 2010-12-04 21:15

Subject: Re: [PATCH 02/14] msvc: git-daemon.exe: Fix linker "unresolved externals" error
Message-ID: <AANLkTi=cVTcaQTQqNeQoNHhUrEBZvE5B=aFDy=r+k0uQ@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3DcVTcaQTQqNeQoNHhUrEBZvE5B%3DaFDy%3Dr%2Bk0uQ%40mail.gmail.com
In-Reply-To: <4CFA8EB7.9070000@ramsay1.demon.co.uk>

```
On Sat, Dec 4, 2010 at 7:55 PM, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:
>
> The msvc linker complains about external symbols referenced by
> the new poll() emulation code. In particular, it complains about
> the DispatchMessage(), PeekMessage(), TranslateMessage() and
> MsgWaitForMultipleObjects() functions.
>
> In order to satisfy the external references, we link against the
> user32.lib library.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>  Makefile |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 1d42413..bda9fa6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1087,7 +1087,7 @@ ifeq ($(uname_S),Windows)
>        COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o compat/win32/pthread.o compat/win32/syslog.o compat/win32/sys/poll.o
>        COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/fnmatch -Icompat/regex -Icompat/fnmatch -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
>        BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
> -       EXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib
> +       EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib
>        PTHREAD_LIBS =
>        lib =
>  ifndef DEBUG

Looks sane. But it's a bit odd - it currently builds fine without this
patch from the IDE, but not from the makefile. Is the linker-libs
different between these?

```

## Ramsay Jones, 2010-12-08 00:11

Subject: Re: [PATCH 02/14] msvc: git-daemon.exe: Fix linker "unresolved externals" error
Message-ID: <4CFECD34.3080809@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/4CFECD34.3080809%40ramsay1.demon.co.uk
In-Reply-To: <AANLkTi=cVTcaQTQqNeQoNHhUrEBZvE5B=aFDy=r+k0uQ@mail.gmail.com>

```
Erik Faye-Lund wrote:
> On Sat, Dec 4, 2010 at 7:55 PM, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:
>> The msvc linker complains about external symbols referenced by
>> the new poll() emulation code. In particular, it complains about
>> the DispatchMessage(), PeekMessage(), TranslateMessage() and
>> MsgWaitForMultipleObjects() functions.
>>
>> In order to satisfy the external references, we link against the
>> user32.lib library.
>>
>> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
>> ---
>>  Makefile |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 1d42413..bda9fa6 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -1087,7 +1087,7 @@ ifeq ($(uname_S),Windows)
>>        COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o compat/win32/pthread.o compat/win32/syslog.o compat/win32/sys/poll.o
>>        COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/fnmatch -Icompat/regex -Icompat/fnmatch -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
>>        BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
>> -       EXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib
>> +       EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib
>>        PTHREAD_LIBS =
>>        lib =
>>  ifndef DEBUG
> 
> Looks sane. But it's a bit odd - it currently builds fine without this
> patch from the IDE, but not from the makefile. Is the linker-libs
> different between these?

Er... dunno! ;-) I don't use the IDE (except to read the msdn docs), I'm
*much* more productive in vim (yeah, I'm a luddite!).

So, how did you create your project file? What does it say?
ie. you tell me! :-P

ATB,
Ramsay Jones

```

## Erik Faye-Lund, 2010-12-08 12:41

Subject: Re: [PATCH 02/14] msvc: git-daemon.exe: Fix linker "unresolved externals" error
Message-ID: <AANLkTi=oP2dNT_ju=wEsZkupV0Qf3zFci_mWQgCYh71Q@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3DoP2dNT_ju%3DwEsZkupV0Qf3zFci_mWQgCYh71Q%40mail.gmail.com
In-Reply-To: <4CFECD34.3080809@ramsay1.demon.co.uk>

```
On Wed, Dec 8, 2010 at 1:11 AM, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:
> Erik Faye-Lund wrote:
>> On Sat, Dec 4, 2010 at 7:55 PM, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:
>>> The msvc linker complains about external symbols referenced by
>>> the new poll() emulation code. In particular, it complains about
>>> the DispatchMessage(), PeekMessage(), TranslateMessage() and
>>> MsgWaitForMultipleObjects() functions.
>>>
>>> In order to satisfy the external references, we link against the
>>> user32.lib library.
>>>
>>> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
>>> ---
>>>  Makefile |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/Makefile b/Makefile
>>> index 1d42413..bda9fa6 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -1087,7 +1087,7 @@ ifeq ($(uname_S),Windows)
>>>        COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o compat/win32/pthread.o compat/win32/syslog.o compat/win32/sys/poll.o
>>>        COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/fnmatch -Icompat/regex -Icompat/fnmatch -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
>>>        BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
>>> -       EXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib
>>> +       EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib
>>>        PTHREAD_LIBS =
>>>        lib =
>>>  ifndef DEBUG
>>
>> Looks sane. But it's a bit odd - it currently builds fine without this
>> patch from the IDE, but not from the makefile. Is the linker-libs
>> different between these?
>
> Er... dunno! ;-) I don't use the IDE (except to read the msdn docs), I'm
> *much* more productive in vim (yeah, I'm a luddite!).
>
> So, how did you create your project file? What does it say?
> ie. you tell me! :-P
>

probably by contrib/buildsystems/generate, but I don't quite remember ;)

Anyway, if the result of contrib/buildsystems/generate builds
differently than "make MSVC=1", then I consider this an issue with
contrib/buildsystems/generate, not the MSVC-port.

I can try to reproduce it at some point, but I'm really tight on time right now.

```
