|
From: John E. <jo...@ti...> - 2016-05-02 10:46:23
|
I just came across a compiler issue when building with MSVC. It's in
the function alloc_server_thread() (in 'src/server_thread.c'):-
static lo_server_thread alloc_server_thread(lo_server s)
{
if (!s)
return NULL;
lo_server_thread st = (lo_server_thread) // <--- PROBLEM IS
AT THIS LINE !!!
malloc(sizeof(struct _lo_server_thread));
// rest of function. . .
}
The problem arises because 'server_thread.c' is a 'C' file (as opposed
to C++). 'C' does not allow variables to get declared half way down a
function (they need to get declared at the top of the function). Many
compilers ignore that nowadays but MSVC is still quite strict about
stuff like that. So making this small change enables it to compile
correctly:-
static lo_server_thread alloc_server_thread(lo_server s)
{
lo_server_thread st; // <--- MOVE THE DECLARATION TO HERE
if (!s)
return NULL;
st = (lo_server_thread) malloc(sizeof(struct _lo_server_thread));
// rest of function. . .
}
Just thought I'd pass this upstream. Best regards,
John
|