Automatic link ws2_32.lib when using MSVC

201 views
Skip to first unread message

nullable.type

unread,
Mar 30, 2012, 2:17:09 AM3/30/12
to mongoos...@googlegroups.com
Hi,
 
I suggest to add the following line into mongoose.c:
 
#if defined(_MSC_VER)
    #pragma comment (lib, "Ws2_32.lib")
#endif
 
This automatically links the sepcified lib-file when using MSVC.
 
Cheers Simon

jeff shanab

unread,
Mar 30, 2012, 11:55:37 AM3/30/12
to mongoos...@googlegroups.com
Won't this potentially break some build systems that generate the solutions like cmake, eclipse, codeblocks, etc.
Is this pragma a visual studio only shorthand to include something that should be in the project?
If so, do we want to put in source code such build project details?

--
You received this message because you are subscribed to the Google Groups "mongoose-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongoose-users/-/pWPpjxyRgKoJ.
To post to this group, send email to mongoos...@googlegroups.com.
To unsubscribe from this group, send email to mongoose-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongoose-users?hl=en.

Saighdiúir Álainn

unread,
Mar 30, 2012, 3:13:03 PM3/30/12
to mongoos...@googlegroups.com
On Fri, Mar 30, 2012 at 4:55 PM, jeff shanab <jsha...@gmail.com> wrote:
Won't this potentially break some build systems that generate the solutions like cmake, eclipse, codeblocks, etc.
Is this pragma a visual studio only shorthand to include something that should be in the project?
If so, do we want to put in source code such build project details?

I think it should be fine, #if defined(_MSC_VER) should is true only for microsoft compiler.

nullable.type

unread,
Mar 31, 2012, 3:54:24 AM3/31/12
to mongoos...@googlegroups.com
@Sergey: Yes, with the _MSC_VER macro this applies only to MSVC
@jshanab: This would only links against the anyway required library ws2_32.lib (no additional includes), it works even if you specify to link the library in your cmake script.
 
Probably the question is more whether it is worth automatically link this library for MSVC, but not for a mingw setup or any other setup.
 
Simon
 

On Friday, March 30, 2012 9:13:03 PM UTC+2, Sergey Lyubka wrote:
On Fri, Mar 30, 2012 at 4:55 PM, jeff shanab <jsha...@gmail.com> wrote:
Won't this potentially break some build systems that generate the solutions like cmake, eclipse, codeblocks, etc.
Is this pragma a visual studio only shorthand to include something that should be in the project?
If so, do we want to put in source code such build project details?

I think it should be fine, #if defined(_MSC_VER) should is true only for microsoft compiler.
 
On Fri, Mar 30, 2012 at 1:17 AM, nullable.type <nullab...@gmail.com> wrote:
Hi,
 
I suggest to add the following line into mongoose.c:
 
#if defined(_MSC_VER)
    #pragma comment (lib, "Ws2_32.lib")
#endif
 
This automatically links the sepcified lib-file when using MSVC.
 
Cheers Simon

--
You received this message because you are subscribed to the Google Groups "mongoose-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongoose-users/-/pWPpjxyRgKoJ.
To post to this group, send email to mongoose-users@googlegroups.com.
To unsubscribe from this group, send email to mongoose-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/mongoose-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "mongoose-users" group.
To post to this group, send email to mongoose-users@googlegroups.com.
To unsubscribe from this group, send email to mongoose-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages