Cannot bind interfaces that use pointers to floats. (Have not checked other types.)
The following types in APIDefinition.cs generate an error:
// @required -(_Bool)audioProcessingCallback:(float **)buffers inputChannels:(unsigned int)inputChannels outputChannels:(unsigned int)outputChannels numberOfSamples:(unsigned int)numberOfSamples samplerate:(unsigned int)samplerate hostTime:(UInt64)hostTime;
unsafe bool AudioProcessingCallback (float** buffers, uint inputChannels, uint outputChannels, uint numberOfSamples, uint samplerate, ulong hostTime);
buffers is supposed to be a pointer to an array of floats.
This example also fails but could be worked around using "ref float freqs"
// -(void)getFrequencies:(float *)freqs;
void GetFrequencies( float freqs );
What's the actual error?
Created attachment 12524 [details]
Projects that reproduce problem.
This project reproduces the problem. It contains the Objective-C XCode project and the Xamarin Binding project. Just build the Binding project to see the errors.
I have added notes to the ApiDefinition.cs file that shows one workaround.
Each binding item produces a slightly different error so best to comment them out one by one and see the result.
If you build the entire ApiDefintiion you get:
BTOUCH: error BI1012: btouch: No Export or Bind attribute defined on SuperPoweredWrapper.BandPassFilter.ArrayOfFloatArrays
void ArrayOfFloats (float freqs, int numBands) generates the following error:
obj/Debug/ios/SuperPoweredWrapper/BandPassFilter.g.cs(76,43): error CS1503: Argument `#1' cannot convert `float' expression to type `Foundation.NSObject'
Task "Csc" execution -- FAILED
unsafe void ArrayOfFloats (float* freqs, int numBands); generates the following error:
BTOUCH: error BI1002: btouch: Unknown kind Single* freqs in method 'SuperPoweredWrapper.BandPassFilter.ArrayOfFloats'
THIS ONE WORKS: void ArrayOfFloats (ref float freqs, int numBands);
unsafe void ArrayOfFloatArrays (float** freqs, int numBands, int numBuffers); generates the following error:
BTOUCH: error BI1002: btouch: Unknown kind Single** freqs in method 'SuperPoweredWrapper.BandPassFilter.ArrayOfFloatArrays'
unsafe void PointerToVoid (void* freqs, int numBands); generates the following error:
BTOUCH: error BI1002: btouch: Unknown kind System.Void* freqs in method 'SuperPoweredWrapper.BandPassFilter.PointerToVoid'
I forgot to add that the XCode project is built with Makefile. That will generate the ApiDefinitions.cs file which I then hand edited.
Binding support is limited to the most frequently used types (we usually add support for more types when someone requests it though).
In most cases this can be worked around using IntPtr and manually marshalling data as required.