[Live-devel] Annoying "C" Linkage Problem under MSVC - _close()
Ross Finlayson
finlayson at live.com
Fri Apr 15 17:54:28 PDT 2005
>Finally got around to implementing some custom classes to stream MPEG4 A/V
>directly from an encoder. In doing so I ran into an annoying problem where
>MSVC whined about "a second C Linkage" of the _close(int) function.
>
>Looking at the code it is plain to see that _close is redefined in
>NetCommon.h depending on linux or windows compile. This is done as you
>cannot "close()" a socket in windows as you can in linux, as files and
>socket FD's are not interchangable.
FYI, this is true for all Unix systems - not just Linux.
>In my local tree I changed this define to be:
>
>// windows
>#define CloseSocket closesocket
>
>// Linux
>#define CloseSocket close
>
>And replaced all instances of _close with CloseSocket
>
>My problem of "Multiple C Linkage" went away and I now feel more comfortable
>with a cleaner namespace :)
OK, I'll make this change (actually, I'll probably use "closeSocket"
instead of "CloseSocket") in the next release of the software.
Ross Finlayson
LIVE.COM
<http://www.live.com/>
More information about the live-devel
mailing list