Jump to content

EttoreBarattelli

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by EttoreBarattelli

  1. Hi all,

    after a few attemps, I managed to get a "Hello World" Win32 project to compile and run on Visual Studio (the version I'm using is Visual Studio 2013, toolkit v120), but it did require a few changes in the uGFX library code.

    The procedure I'm using is the following:

    • generate code (i.e. preview button in uGFX Studio) for a Hello World project (a simple container with a Label widget) from uGFX Studio (version 0.15 for Windows)
    • create a VS solution to compile both the uGFX library and the GUI code generated by uGFX Studio

    To compile the library I'm using the "single file inclusion" method, therefore I just added the "gfx_mk.c" and "gdisp_lld_Win32.c" files (as well as "gui.c" and "main.c" generated by uGFX Studio) in the VS solution and set the include paths and preprocessor symbols accordingly.

    Here the list of changes I had to apply to the uGFX library code:

    • file src/gos/gos_win32.c:
      • changed line 77:
    //typedef LONG __stdcall (*_NtQuerySemaphore)(  // INITIAL
    typedef LONG (__stdcall *_NtQuerySemaphore)(    // FIXED
    • file src/gos/gos_win32.c:
      • changed line 100:
    //gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {  // INITIAL
    gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param) {      // FIXED
    • file src/gos/gos_win32.h:
      • changed lines 49-50:
    //#define DECLARE_THREAD_FUNCTION(fnName, param)	threadreturn_t WINAPI fnName(void *param)    // INITIAL
    //#define DECLARE_THREAD_STACK(name, sz)		uint8_t name[0];
    #define DECLARE_THREAD_FUNCTION(fnName, param)		threadreturn_t (WINAPI fnName)(void *param)  // FIXED
    #define DECLARE_THREAD_STACK(name, sz)			uint8_t name[sz];
    • file src/gos/gos_win32.h:
      • changed line 99:
    //gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); // INITIAL
    gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param);     // FIXED
    • file src/gfx_compilers.h:
      • changed line 728:
    //#warning "You are using an un-tested compiler. Please report any compile errors or warnings on the ugfx forum"         // INITIAL
    #pragma message( "You are using an un-tested compiler. Please report any compile errors or warnings on the ugfx forum" ) // FIXED
    • file src/gfx_compilers.h:
      • changed line 901:
    //#define GFXINLINE	inline        // INITIAL
    #define GFXINLINE	__forceinline // FIXED

     

    Obviously these changes are specific to Visual Studio and might (and probably will) break other compilers. If you like I can share the project with all resources (VS solution, updated uGFX library code, generated code for sample GUI).

     

    Thanks,

    Ettore

×
×
  • Create New...