Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed some compilation errors when compiling using clang-cl.exe #560

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

georg-emg
Copy link

When compiling the osal sub directory under Windows using clang-cl.exe, some compiler errors occurred. This patch fixes these errors, so that SOEM can be built under Windows using clang-cl.

@@ -29,6 +29,7 @@
} \
} while (0)

struct timezone;
int osal_gettimeofday (struct timeval *tv, struct timezone *tz);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The declaration of osal_gettimeofday can be removed hence no need to add forward declaration of struct timezone.
I believe osal_win32.h might be removed all together

{
*thandle = CreateThread(NULL, stacksize, func, param, 0, NULL);
*(void **)thandle = CreateThread(NULL, stacksize, func, param, 0, NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to typecast it to PHANDLE instead of void ** , very much like the linux port

int osal_thread_create(void *thandle, int stacksize, void *func, void *param)
{
PHANDLE phandle = thandle;

*phandle = CreateThread(NULL, stacksize, func, param, 0, NULL);
if(*phandle != NULL)
{
return 0;
}
return 1;
}

int osal_thread_create_rt(void *thandle, int stacksize, void *func, void *param)
{
int ret;
PHANDLE phandle = thandle;

ret = osal_thread_create(phandle, stacksize, func, param);
if (ret)
{
ret = SetThreadPriority(*phandle, THREAD_PRIORITY_TIME_CRITICAL);
}
return ret;
}

@nakarlsson
Copy link
Contributor

@georg-emg , sorry for late response. Small suggestions and I don't have clang on windows so please test and give feedback.

@aditmak
Copy link

aditmak commented Nov 14, 2022

@nakarlsson, suggested changes have been added and tested with clang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants