• Linking xpdev and ciolib on XP

    From Saper@VERT to All on Sun Aug 7 14:36:14 2016
    Hello,

    I am not a regular here at all (once played
    with fixing an obscure X11 copy paste bug), but
    I am very fond of the Synchronet's conio implementation
    and I have managed to plug it into one of my
    toy projects using a dialect of Forth called FICL.

    Since the app needs to run perfectly on Windows XP
    I am using Microsoft Visual C++ 6.0 (yes!) and
    Microsoft Platform SDK for Windows XP SP2.
    I can see from the CVS log that nobody tries
    to use such an ancient compiler anymore, but I'd like
    to propose a few changes to make things still work
    for poor souls like myself:

    First, when attaching SDL.LIB we get conflicting
    uintptr_t and intptr_t definitions from <gen_defs.h>
    from xpdev and from the SDL headers themselves
    (I am using SDL 1.2.15 here). The fix was easy,
    just adding

    #define _UINTPTR_T_DEFINED
    #define _INTPTR_T_DEFINED

    after typedef intmax_t in gen_defs.h

    Since the build description on the SBBS page
    (probably outdated) still refers to MS VC++ 6.0,
    I'd like to sugest one more hint there:
    it is important that Platform SDK includes
    and libraries directories are searched FIRST
    by the MS VC++, otherwise one gets lots of undefined
    things related to the IPv6 APIs that appeared
    in Windows XP. (MS VC++ has old mswsoc.h and ws2tcpip.h
    and they won't work with the wspiapi.h).

    Since I don't need sockets in my app, I tried
    defining NO_SOCKET_SUPPORT for xpdev - that does not work
    anymore, since sockwrap.h is also needed by netwrap.c
    unconditionally. Probably NO_SOCKET_SUPPORT
    should cover more pieces of code (or should be
    removed altogether).

    A recent vasprintf change breaks the ancient
    Windows setup as well. What I did to make it
    compie is to replace

    #if defined(_MSC_VER) || defined (__MSVCRT__)

    with

    #if _MSC_VER >= 1500

    around vasprintf and asprintf definition.

    Probably xp_asprintf_next should be wrapped
    in this #if as well since the compiler
    complans about undefined asprintf() in its
    body (lines 1185+ in xpprintf.c).

    I also get a warning about undefined
    _mkgmtime in datewrap.c(76).

    With the above changes I was able to compile
    and link xpdev with conio and use some of the
    ciolib's features (haven't tried conio_printf()
    yet).

    conio itself didn't need any changes to get
    it working on XP in my setup.

    Below please find my diffs to make it work
    for me:

    diff -ru src/xpdev/gen_defs.h src.mod/xpdev/gen_defs.h
    -+- src/xpdev/gen_defs.h 2015-12-04 09:23:17.000000000 +0000
    +++ src.mod/xpdev/gen_defs.h 2016-08-07 21:24:34.760714000 +0000
    @@ -183,6 +183,8 @@
    #if !defined(HAS_STDINT_H) && !defined(_UINTPTR_T_DEFINED)
    typedef uintmax_t uintptr_t;
    typedef intmax_t intptr_t;
    +#define _UINTPTR_T_DEFINED
    +#define _INTPTR_T_DEFINED
    #endif

    /* printf integer formatters: */
    diff -ru src/xpdev/xpprintf.c src.mod/xpdev/xpprintf.c
    -+- src/xpdev/xpprintf.c 2015-09-29 00:48:52.000000000 +0000
    +++ src.mod/xpdev/xpprintf.c 2016-08-07 21:24:34.699328000 +0000
    @@ -45,7 +45,7 @@
    #include "xpprintf.h"
    #include "gen_defs.h"

    -#if defined(_MSC_VER) || defined(__MSVCRT__)
    +#if _MSC_VER >= 1500
    int DLLCALL vasprintf(char **strptr, char *format, va_list va)
    {
    va_list va2;
    diff -ru src/xpdev/xpprintf.h src.mod/xpdev/xpprintf.h
    -+- src/xpdev/xpprintf.h 2015-09-28 22:36:12.000000000 +0000
    +++ src.mod/xpdev/xpprintf.h 2016-08-07 21:24:34.696641000 +0000
    @@ -79,7 +79,7 @@
    DLLEXPORT char* DLLCALL xp_asprintf(const char *format, ...);
    DLLEXPORT char* DLLCALL xp_vasprintf(const char *format, va_list va);
    DLLEXPORT int DLLCALL xp_printf_get_type(const char *format);
    -#if defined(_MSC_VER) || defined(__MSVCRT__)
    +#if _MSC_VER >= 1500
    DLLEXPORT int DLLCALL vasprintf(char **strptr, char *format, va_list va);
    DLLEXPORT int DLLCALL asprintf(char **strptr, char *format, ...);
    #endif

    Thanks for keeping Synchronet alive, I am not
    much into the BBS thing but I find the ciolib
    a very cool feature.

    Saper
    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From Mro@VERT to Saper on Sun Aug 7 17:40:25 2016
    Re: Linking xpdev and ciolib on XP
    By: Saper to All on Sun Aug 07 2016 02:36 pm

    Hello,

    I am not a regular here at all (once played
    with fixing an obscure X11 copy paste bug), but
    I am very fond of the Synchronet's conio implementation
    and I have managed to plug it into one of my



    what with the funny paragraph formatting?
    ---
    þ Synchronet þ ::: BBSES.info - free BBS services :::
  • From Saper@VERT to All on Mon Aug 8 14:53:07 2016
    Re: Linking xpdev and ciolib on XP
    By: Mro to Saper on Sun Aug 07 2016 05:40 pm

    what with the funny paragraph formatting?

    Sorry for that, I am not used to the FSEditor I was using to compose this message. So the proper etiquette is to let the paragraphs flow as in this one?

    Marcin
    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net