DSL
Classes | Macros | Typedefs | Functions
DSL Core Functions & Data Types

Classes

struct  DSL_VERSION
 

Macros

#define DSL_OPTION_SSL   0x00000001
 
#define DSL_OPTION_ZLIB   0x00000002
 
#define DSL_OPTION_MEMLEAK   0x00000004
 
#define DSL_OPTION_MYSQL   0x00000008
 
#define DSL_OPTION_PHYSFS   0x00000010
 
#define DSL_OPTION_CURL   0x00000020
 
#define DSL_OPTION_SQLITE   0x00000040
 
#define DSL_OPTION_SODIUM   0x00000080
 
#define DSL_OPTION_OPENSSL   0x00000100
 
#define DSL_OPTION_GNUTLS   0x00000200
 
#define dsl_freenn(ptr)   if (ptr) { dsl_free(ptr); }
 
#define dsl_new(x)   (x *)dsl_malloc(sizeof(x));
 
#define bool   unsigned char
 
#define I64FMT   "%" PRId64 ""
 
#define U64FMT   "%" PRIu64 ""
 
#define VOID   void
 
#define SOCKET   int
 
#define BYTE   unsigned char
 
#define HANDLE   void *
 
#define PATH_SEP   '/'
 
#define PATH_SEPS   "/"
 
#define WPATH_SEPS   L"/"
 
#define TPATH_SEPS   PATH_SEPS
 
#define tstring   string
 
#define tstat   stat
 
#define tstatstruct   stat
 
#define taccess   _access
 
#define tremove   remove
 
#define tgetcwd   getcwd
 
#define ttoi   atoi
 
#define BIG_ENDIAN
 

Typedefs

typedef int64_t int64
 
typedef uint64_t uint64
 
typedef int32_t int32
 
typedef uint32_t uint32
 
typedef int16_t int16
 
typedef uint16_t uint16
 
typedef int8_t int8
 
typedef uint8_t uint8
 
typedef wchar_t wchar
 
typedef char tchar
 

Functions

DSL_API void DSL_CC dsl_get_version (DSL_VERSION *ver)
 Fills in a DSL_VERSION struct you provide.
 
DSL_API const char *DSL_CC dsl_get_version_string ()
 Returns the DSL version string.
 
DSL_API bool DSL_CC dsl_init ()
 
DSL_API void dsl_cleanup ()
 
DSL_API bool DSL_CC dsl_fill_random_buffer (uint8 *buf, size_t len)
 
DSL_API void *DSL_CC dsl_malloc (size_t lSize)
 
DSL_API void *DSL_CC dsl_realloc (void *ptr, size_t lSize)
 
DSL_API char *DSL_CC dsl_strdup (const char *ptr)
 
DSL_API wchar_t *DSL_CC dsl_wcsdup (const wchar_t *ptr)
 
DSL_API char *DSL_CC dsl_mprintf (const char *fmt,...)
 
DSL_API_CLASS string mprintf (const string fmt,...)
 
DSL_API char *DSL_CC dsl_vmprintf (const char *fmt, va_list va)
 
DSL_API wchar_t *DSL_CC dsl_wmprintf (const wchar_t *fmt,...)
 
DSL_API void DSL_CC dsl_free (void *ptr)
 

Detailed Description

Macro Definition Documentation

◆ dsl_freenn

#define dsl_freenn (   ptr)    if (ptr) { dsl_free(ptr); }

Call dsl_free on a pointer if it's not NULL

Function Documentation

◆ dsl_cleanup()

DSL_API void dsl_cleanup ( )

Call when your app is exiting or you are done with all DSL functions. Initialization is ref-counted so you need to call it the same number of times you called dsl_init().
Windows: We don't have dsl_cleanup as DSL_CC(__stdcall) so it can be used with atexit().

See also
dsl_init

◆ dsl_fill_random_buffer()

DSL_API bool DSL_CC dsl_fill_random_buffer ( uint8 *  buf,
size_t  len 
)

Fills a buffer with random data.
Windows: Uses RtlGenRandom if available.
Linux: Uses the SYS_getrandom syscall if available, or /dev/urandom, or /dev/random (falling back in that order).
Both: If all the above fails, falls back to rand() :(

◆ dsl_init()

DSL_API bool DSL_CC dsl_init ( )

Call when your app starts to initialize DSL. You can call dsl_init() more than once without issue since it is ref-counted.

See also
dsl_cleanup

◆ dsl_mprintf()

DSL_API char* DSL_CC dsl_mprintf ( const char *  fmt,
  ... 
)

Returns a dynamically allocated string using printf formatting, free with dsl_free.

See also
dsl_free

◆ dsl_vmprintf()

DSL_API char* DSL_CC dsl_vmprintf ( const char *  fmt,
va_list  va 
)

Returns a dynamically allocated string using printf formatting, free with dsl_free.

See also
dsl_free

◆ dsl_wmprintf()

DSL_API wchar_t* DSL_CC dsl_wmprintf ( const wchar_t *  fmt,
  ... 
)

Returns a dynamically allocated string using printf formatting, free with dsl_free.

See also
dsl_free