Skip to content

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.

} 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

int osal_thread_create(void *thandle, int stacksize, void *func, void *param)
{
*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.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ Georg Schwab
❌ aditmak


Georg Schwab seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

4 participants