Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 33107 on
Developer Community or GitHub if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
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.