Thread: using timeSetEvent in Win64
Posts:
7
Registered:
2/28/17
|
|
Hello all,
I am trying to port my SIP library to the Win64 platform. This library
uses timeSetEvent() in order to periodically send RTP packets over
udp.I know that this function is obsolete however it still works fine
with Win32.
When trying to compile for Win64 the declaration of this function
cannot be found in any header file.
I am using BCB 10.2.1
Thanks for any direction
Jarek
|
|
|
Posts:
9,447
Registered:
12/23/01
|
|
Jarek Karciarz wrote:
I know that [timeSetEvent] is obsolete
Says who?
When trying to compile for Win64 the declaration of this function
cannot be found in any header file.
It should be defined in mmsystem.h, which is already included by
windows.h by default.
--
Remy Lebeau (TeamB)
|
|
|
|
Posts:
626
Registered:
10/8/06
|
|
Remy Lebeau (TeamB) wrote:
I know that [timeSetEvent] is obsolete
Says who?
MS
https://msdn.microsoft.com/ru-ru/library/windows/desktop/dd757634(v=vs.85).aspx
It should be defined in mmsystem.h, which is already included by
windows.h by default.
More precisely
"Header
TimeAPI.h (include Windows.h);
Mmsystem.h on Windows Server 2008 R2, Windows 7, Windows 7, Windows
Server 2008 and Windows Vista (include Windows.h)"
--
Alex
|
|
|
|
Posts:
7
Registered:
2/28/17
|
|
Alex Belo wrote:
Remy Lebeau (TeamB) wrote:
I know that [timeSetEvent] is obsolete
Says who?
MS
https://msdn.microsoft.com/ru-ru/library/windows/desktop/dd757634(v=vs.85).aspx
Yes, exactly.
It should be defined in mmsystem.h, which is already included by
windows.h by default.
More precisely
"Header
TimeAPI.h (include Windows.h);
Mmsystem.h on Windows Server 2008 R2, Windows 7, Windows 7, Windows
Server 2008 and Windows Vista (include Windows.h)"
I tried to inlude directly both headers: mmsystem.h and timeapi.h. And
te compiler still complains timeSetEvent() function not found.
I'm afraid some of #defines might prevent the declaration to be visible.
|
|
|
|
Posts:
626
Registered:
10/8/06
|
|
Jarek Karciarz wrote:
I tried to inlude directly both headers: mmsystem.h and timeapi.h. And
the compiler still complains timeSetEvent() function not found.
I'm afraid some of #defines might prevent the declaration to be
visible.
Yes, it is possible. So steps are quite obvious:
1. Search for "timeSetEvent" in text editor.
2. Search for evil #define after that.
--
Alex
|
|
|
|
Posts:
9,447
Registered:
12/23/01
|
|
Jarek Karciarz wrote:
Jarek Karciarz wrote:
I tried to inlude directly both headers: mmsystem.h and timeapi.h.
And the compiler still complains timeSetEvent() function not found.
I'm afraid some of #defines might prevent the declaration to be
visible.
Yes, it is possible. So steps are quite obvious:
1. Search for "timeSetEvent" in text editor.
2. Search for evil #define after that.
timeSetEvent() is declared in mmsystem.h on my system. It is also
wrapped in '#ifndef MMNOTIMER', so make sure MMNOTIMER is not being
defined.
--
Remy Lebeau (TeamB)
|
|
|
|
Posts:
7
Registered:
2/28/17
|
|
Remy Lebeau (TeamB) wrote:
Jarek Karciarz wrote:
Jarek Karciarz wrote:
I tried to inlude directly both headers: mmsystem.h and timeapi.h.
And the compiler still complains timeSetEvent() function not
found. I'm afraid some of #defines might prevent the declaration
to be visible.
Yes, it is possible. So steps are quite obvious:
1. Search for "timeSetEvent" in text editor.
2. Search for evil #define after that.
timeSetEvent() is declared in mmsystem.h on my system. It is also
wrapped in '#ifndef MMNOTIMER', so make sure MMNOTIMER is not being
defined.
I have BCB 10.2.1 and RAD2007. In 10.2.1 the only header file
containing the function name is mmiscapi2.h and I cant see here any
suspicious #define. It curious that i didnt find the declaration in any
of .hpp files although mmsystem.pas contains timeSetEvent() declaration
as an external function. In RAD2007 the declaration is as Remy said
inside mmsystem.h. But RAD is nt my IDE as I compile for Win64
|
|
|
|
Posts:
7
Registered:
2/28/17
|
|
Remy Lebeau (TeamB) wrote:
Jarek Karciarz wrote:
Jarek Karciarz wrote:
I tried to inlude directly both headers: mmsystem.h and timeapi.h.
And the compiler still complains timeSetEvent() function not
found. I'm afraid some of #defines might prevent the declaration
to be visible.
Yes, it is possible. So steps are quite obvious:
1. Search for "timeSetEvent" in text editor.
2. Search for evil #define after that.
timeSetEvent() is declared in mmsystem.h on my system. It is also
wrapped in '#ifndef MMNOTIMER', so make sure MMNOTIMER is not being
defined.
Ok, I solved it. C++ 64 bit compiler is very strict. The error message
was a bit misleading to me: no matching function for call to
timeSetEvent. Problem was that my callback function should be
explicittly casted to (LPTIMECALLBACK). That solved the problem.
Thanks for assistance.
|
|
|
|
Posts:
9,447
Registered:
12/23/01
|
|
Jarek Karciarz wrote:
Problem was that my callback function should be explicittly casted
to (LPTIMECALLBACK). That solved the problem.
If you have to cast your callback, you declared it wrong to begin with.
Fix the declaration, then a cast will not be needed.
--
Remy Lebeau (TeamB)
|
|
|
|
Posts:
7
Registered:
2/28/17
|
|
Remy Lebeau (TeamB) wrote:
Jarek Karciarz wrote:
Problem was that my callback function should be explicittly casted
to (LPTIMECALLBACK). That solved the problem.
If you have to cast your callback, you declared it wrong to begin
with. Fix the declaration, then a cast will not be needed.
Yes, thats correct.
There were some DWORD args in my declaration and they should be
DWORD_PTR. It didnt change since RAD2007, so for win32 compiler there
was no difference but for win64 it was. And that is pretty clear for me
why.
|
|
|
|
Legend
|
|
Helpful Answer
(5 pts)
|
|
Correct Answer
(10 pts)
|
|
Connect with Us