gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MS VC6.0 gnokii DLL (WIN32 x86)


From: Ladislav Michl
Subject: Re: MS VC6.0 gnokii DLL (WIN32 x86)
Date: Wed, 12 Feb 2003 10:11:01 +0100
User-agent: Mutt/1.5.3i

Marcus Godehardt wrote:
> here are the patches for win32/gnokii_vc6 folder i updated the makefiles for
> MSVC6 and removed any absolute pathnames.
> 
> gsm-networks.c --> made countries and networks exportable for gnokii.c
> compat.h       -->

we have functions for accessing these structures in cvs now. gnokii.c is
using this way to list networks, so no need to export them.

static void list_gsm_networks(void)
{
                                                                                
                             
        gn_network network;
        int i = 0;
                                                                                
                             
        printf("Network  Name\n");
        printf("-----------------------------------------\n");
        while (gn_network_get(&network, i++))
                printf("%-7s  %s\n", network.code, network.name);
}

> before: #if !defined(HAVE_SNPRINTF) && !defined(HAVE_C99_SNPRINTF)
> after:  #if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_SNPRINTF)
> 
> if u look at snprintf it must be really a || otherwise i have no prototype
> and the compiler assumes external linkage and return type int (sometimes
> that can blow up the app)

seems correct and matches what we have in common/snprintf.c (but read
below (1))

/* yes this really must be a ||. Don't muck with this (tridge) */
#if !defined(HAVE_VSNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
API int vsnprintf (char *str, size_t count, const char *fmt, va_list
args)
{
        return dopr(str, count, fmt, args);
}
#endif
                                                                                
                             
/* yes this really must be a ||. Don't muck wiith this (tridge)
 *
 * The logic for these two is that we need our own definition if the
 * OS *either* has no definition of *sprintf, or if it does have one
 * that doesn't work properly according to the autoconf test.  Perhaps
 * these should really be smb_snprintf to avoid conflicts with buggy
 * linkers? -- mbp
 */
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_SNPRINTF)
API int snprintf(char *str,size_t count,const char *fmt,...)
{
        size_t ret;
        va_list ap;
                                                                                
                             
        va_start(ap, fmt);
        ret = vsnprintf(str, count, fmt, ap);
        va_end(ap);
        return ret;
}
#endif

btw, why are these functions exported by libgnokii (*) ??? purpose
of libgnokii is providing way to access phone functions nothing more.
(this is probably limitation of having only one configuration script
for programs with different needs - libgnokii, gnokii, xgnokii and smsd
(and virtmodem stuff))

(*) gnokii.dll in windows

(1) MSVC <stdio.h> contains this definition: 
int _snprintf( char *buffer, size_t count, const char *format, ...);
_snprintf appears to be C99 compilant so what about
#define HAVE_SNPRINTF     1
#define HAVE_C99_SNPRINTF 1
#define snprintf _snprintf
instead of compiling our own snprintf?


> With these patches u can compile gnokii.exe and gnokiid.lib ( only debug
> version at this moment )
> 
> add under Tools->Options->Directories
> 
> Add Include gnokii/win32/gnokii_vc6 and gnokii/include ( so it will find
> config.h )
> Add Lib Path  gnokii/win32/gnokii_vc6/lib ( thats where linker will find
> gnokiid.lib )

two questions here:
1) why is windows library called gnokiid.dll
2) wouldn't be better to use native _snprintf implementation?

> Next part will be the C++ port part, coming next ...

cool :)

        ladis




reply via email to

[Prev in Thread] Current Thread [Next in Thread]