|Re: [hatari-devel] Can't build Hatari on Mac if PortMidi is not installed|
[ Thread Index |
| More lists.tuxfamily.org/hatari-devel Archives
Le 23/05/2022 à 18:49, Chris Jenkins a écrit :
I tried to build Hatari on my Mac (which does not have the PortMidi
library) and found that the build was failing with the following:
error: implicit declaration of function 'Midi_Host_GetPortName' is
invalid in C99 [-Werror,-Wimplicit-function-declaration]
while ((portName = Midi_Host_GetPortName(portName, +1, true)))
It turns out that the function Midi_Host_GetPortName is not built at all
if PortMidi is not found on the machine but that the Mac UI code that
calls it _/is/_ built (and fails because the function definition doesn't
Attached is my initial attempt to fix it. Note that this is my first
attempt to contribute code to Hatari so I'm unsure whether I've done the
right thing. In particular, I'm not sure if it's ok to #ifdef out parts
of the UI initialisation code, or precisely how much to #ifdef out. I'm
interested in any feedback on the approach.
thanks for your patch and testing Hatari on macOS.
I can't test it myself, but in that case and looking at
PrefsController.m I think it's OK.
There's no rule whether #ifdefing all the lines is OK or not, you need
to ensure that it will not leave the UI in a buggy state, sometimes
adding a #else to replace removed code by something else.
Here we see the dropdown list is populated with "Off" by default, so
#ifdef of the rest will just keep only the "Off" choice and this should
be OK I think.