[CDRIVER-993] Compile error on windows Created: 12/Nov/15 Updated: 08/Dec/15 Resolved: 20/Nov/15 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | 1.2.1 |
| Fix Version/s: | 1.3.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Alex | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows, msvs 2010 |
||
| Issue Links: |
|
||||||||
| Description |
|
error C2664: 'CreateThread' : cannot convert parameter 3 from 'void *' to 'LPTHREAD_START_ROUTINE' WinApi CreateThread() expects pointer to function that returns DWORD, but linux system cal pthread_create expects pointer to function that returns void * |
| Comments |
| Comment by Githook User [ 20/Nov/15 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: |
| Comment by Alex [ 13/Nov/15 ] |
|
Visual studio uses c++ compiler mode for .cpp files and it seems like c++ language have more strict rules of casting, this is why error occurs. void* and DWORD return value types have different sizes so I'm not sure this cast is safe. |
| Comment by A. Jesse Jiryu Davis [ 13/Nov/15 ] |
|
Thanks, that is useful information. Until we dig a little further, I'm not sure why it matters how you include the driver's headers. Regardless, it seems like we should be casting the function to LPTHREAD_START_ROUTINE, not void *, in the win32 code. |
| Comment by Alex [ 13/Nov/15 ] |
|
Important note: this error occurs only when using private header in .cpp file(not .c): // my_src.cpp |
| Comment by A. Jesse Jiryu Davis [ 12/Nov/15 ] |
|
Thanks for the report, we'll check it out. |