Skip to content

Problem with timeSetEvent using win32 port #430

Open
@Francis900

Description

@Francis900

I’m encountering two issues while trying to compile a project that contains ThreadX (master branch) in a Win32 port using Visual Studio Code on Windows 10:

Pointer type mismatch with timeSetEvent:
There’s an incompatible pointer type error when passing the third argument to timeSetEvent. The error message is:

Passing argument 3 of 'timeSetEvent' from incompatible pointer type [-Wincompatible-pointer-types].
It seems there’s an issue with the type of the third argument being passed to timeSetEvent.

Warning about #pragma comment:
I’m getting a warning:
#pragma comment: ignoring '#pragma comment' [-Wunknown-pragmas].
The line in question is:
#pragma comment (lib, "Winmm.lib").
This seems to be related to linking the Winmm.lib library, but even after manually adding the library paths to the compiler, it still can't find winmm.lib. I’m unsure why the pragma is being ignored.

I’m using the latest master branch of ThreadX, and I’m working in a Win32 environment with Visual Studio Code with gcc.

Any help with resolving these issues would be greatly appreciated.

\threadx\ports\win32\vs_2019\src\tx_initialize_low_level.c: In function '_tx_initialize_start_interrupts':
C:...\threadx\ports\win32\vs_2019\src\tx_initialize_low_level.c:272:69: error: passing argument 3 of 'timeSetEvent' from incompatible pointer type [-Wincompatible-pointer-types]
  272 |     _tx_win32_timer_id = timeSetEvent(TX_TIMER_PERIODIC, wTimerRes, _tx_win32_timer_interrupt, 0, TIME_PERIODIC);
      |                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                     |
      |                                                                     void (*)(UINT,  UINT,  DWORD,  DWORD,  DWORD) {aka void (*)(unsigned int,  unsigned int,  long unsigned int,  long unsigned int,  long unsigned int)}
In file included from C:/msys64/mingw64/include/mmsystem.h:27,
                 from C:/msys64/mingw64/include/windows.h:86,
                 from C:.../threadx/ports/win32/vs_2019/inc/tx_port.h:162,
                 from C:.../threadx/common/inc/tx_api.h:133,
                 from C:...\threadx\ports\win32\vs_2019\src\tx_initialize_low_level.c:28:
C:/msys64/mingw64/include/mmiscapi2.h:32:85: note: expected 'LPTIMECALLBACK' {aka 'void (*)(unsigned int,  unsigned int,  long long unsigned int,  long long unsigned int,  long long unsigned int)'} but argument is of type 'void (*)(UINT,  UINT,  DWORD,  DWORD,  DWORD)' {aka 'void (*)(unsigned int,  unsigned int,  long unsigned int,  long unsigned int,  long unsigned int)'}
   32 | WINMMAPI MMRESULT WINAPI timeSetEvent(UINT uDelay, UINT uResolution, LPTIMECALLBACK fptc, DWORD_PTR dwUser, UINT fuEvent);
      |                                                                      ~~~~~~~~~~~~~~~^~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghardwareNew hardware or architecture support request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions