STLPort Instructions

     

    1.  You need to include the STLport-4.0\stlport directory BEFORE the MSVC include directories.  It's probably safest to first exclude all the standard include files, then use something like the following:

    c:\stlport-4.0\stlport,..\..\Include,..\..\Include\Internal,$(PLATFORMSDK_ROOT)

    \include,$(VISUALSTUDIO_ROOT)\include

    2.  You need to link with the libc.lib-rim library AFTER the RIM .objs.  For example:

    ..\..\Lib\OsEntry.obj ..\..\Lib\RimOs.lib ..\..\Lib\ribbon.lib ..\..\Lib\UI32.lib  c:\libc.lib-rim

    3.  You need to include the following definitions.

    -----------------------------

    extern "C" {

    #include <stdarg.h>

    void abort() {
      RimCatastrophicFailure("abort");
    }

    void _assert(void*, void*, unsigned) {
      RimCatastrophicFailure("_assert");
    }

    int _fltused = 0;

    void free(void* f) {
            RimFree(f);
    }

    void* malloc(size_t t) {
            return RimMalloc(t);
    }

    void* realloc(void* v, size_t t) {
            return RimRealloc(v, t);
    }

    void exit(int s) {
      RimCatastrophicFailure("exit");
    }

    int printf (const char *format, ...)
    {
      va_list ap;
      va_start (ap, format);
      int result = 1;
      RimDebugPrintf (format, ap);
      va_end (ap);
      return result;
    }

    #if 0

    FILE _iob[256];

    int fileno(FILE* f) {
            return -1;
    }

    int PASCAL FAR __WSAFDIsSet(SOCKET fd, fd_set FAR* set) {
      for (int i = 0; i < set->fd_count; i++)
        if (set->fd_array[i] == fd) return 1;
      return 0;
    }

    int fprintf (FILE* fp, const char *format, ...)
    {
      return -1;
    }

    size_t fread(void*, size_t, size_t, FILE*) {
      return 0;
    }

    size_t fwrite(const void *, size_t, size_t, FILE *) {
      return 0;
    }

    int fflush(FILE*) {
      return EOF;
    }

    int getc(FILE* f) {
      return -1;
    }
    #endif

    int putchar(int i) {
      return -1;
    }

    int* _errno() {
      static int err = 0;
      return &err;
    }

    }

     

Website design: Sessionware  Copyright ©2001 Bill Foust.  The BlackBerry and RIM families of related marks, images and symbols are the exclusive properties and trade-marks of Research In Motion Limited and are used by permission.  Trademarks and product names listed on this site are the sole property of their respective owners.  This page last updated on April 05, 2001