Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#1113 closed Defect (fixed)

r23647 breaks boinc_api.h for C

Reported by: MattArsenault Owned by: davea
Priority: Trivial Milestone: Undetermined
Component: BOINC - API Version:
Keywords: Cc:

Description

r23647 introduced this into the BOINC API header. Since bool doesn't exist in C, this doesn't work. I don't know what the purpose of these are, and can't actually find them used in the source. They could move somewhere else (perhaps down to the implementation stuff), but another alternative is to just use int. Tangentially related, the graphics API should use C linkage.

#ifdef _WIN32

Jason: New windows exit handling to play more nicely with cuda & MS-CRT extern volatile bool worker_thread_exit_request; extern volatile bool worker_thread_exit_ack;

#endif

Attachments (2)

DontUseCPP.diff (651 bytes) - added by MattArsenault 13 years ago.
Replace bool with int
DontUseCPPGraphics.diff (1.0 KB) - added by MattArsenault 13 years ago.
Use extern C for graphics API

Download all attachments as: .zip

Change History (6)

Changed 13 years ago by MattArsenault

Attachment: DontUseCPP.diff added

Replace bool with int

Changed 13 years ago by MattArsenault

Attachment: DontUseCPPGraphics.diff added

Use extern C for graphics API

comment:1 Changed 13 years ago by davea

Resolution: fixed
Status: newclosed

The first problem was already fixed.

Is there any reason to use extern C for the graphics API? i.e. is there any project that writes its graphics app in C (and if so, why?)

comment:2 Changed 13 years ago by MattArsenault

I just checked the current r23698 and it's still there.

A more appropriate question would be why would it have C++ linkage. Those functions don't actually need any C++ features, so the only thing these are getting are mangled names, needlessly breaking linking from C as well as linking between binaries from different compilers (i.e. on Windows mixing different libraries compiled with MinGW and Visual Studio). It not only breaks usage from C, but if something were to be written in any other language, C FFIs are much more common and work much better. C++ is a bad language that adds a massive amount of complexity with minimal benefit, so plenty of people stick with C.

comment:3 Changed 13 years ago by davea

Oops, I forgot to check in boinc_api.h

Anti-C++ rants aside, has any project written or wanted to write a graphics module in C?

comment:4 Changed 13 years ago by MattArsenault

I've been working one one. Right now I have a wrapper calling the actual functions, and it's just kind of dumb.

Note: See TracTickets for help on using tickets.