Declare statement: how to implement void functions

I would like to use Apple’s CoreMIDI library inline in Xojo.

The MIDIGetNumberOfSources call does not require any arguments. However, if I do not put something in the brackets, I get errors such as ‘Objective-C declares must have at least one parameter (the target of the message)’.

How to get past this?

EDIT: Below is a sample declaration I am making:
Declare Function MIDIGetNumberOfSources Lib "CoreMIDI" Selector "MIDIGetNumberOfSources" As Integer

in xojo a “Sub” is a method wihtout a return value, a “Function” is a method that does return a value.
So the “Sub” is the same as “void myFunc(){}” in c/c++

This function:

ItemCount MIDIGetNumberOfSources(void);

Does return a value of type “ItemCount” and has no parameters (void)
That means it’s the same as a Xojo “Function” since it has a return value.

Try this one, i don’t think you need a selector since i see no selector in the Objective-C docs.

Soft Declare Function MIDIGetNumberOfSources Lib "CoreMIDI" () As Integer
1 Like
Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.