www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - "function not callable using argument types" - i disagree

reply "Vlad Levenfeld" <vlevenfeld gmail.com> writes:
I'm trying to use the portaudio bindings and can't seem to call 
Pa_OpenStream, I get this error:

------------
source/pa_test.d(156): Error: function 
deimos.portaudio.Pa_OpenStream (void** stream, 
const(PaStreamParameters*) inputParameters, 
const(PaStreamParameters*) outputParameters, double sampleRate, 
uint framesPerBuffer, uint streamFlags, extern (C) int 
function(const(void)* input, void* output, uint frameCount, 
const(PaStreamCallbackTimeInfo)* timeInfo, uint statusFlags, 
void* userData) streamCallback, void* userData) is not callable 
using argument types (void**, PaStreamParameters*, 
PaStreamParameters*, double, uint, uint, extern (C) int 
function(const(void)* inputBuffer, void* outputBuffer, uint 
framesPerBuffer, const(PaStreamCallbackTimeInfo)* timeInfo, uint 
statusFlags, void* userData), void*)
------------

for clarity, here are the argument lists separated: what I need 
is up top, what I have is on the bottom:

(void**, const(PaStreamParameters*), const(PaStreamParameters*), 
double, uint, uint, extern (C) int function(const(void)*, void*, 
uint, const(PaStreamCallbackTimeInfo)*, uint, void*), void*)

(void**, PaStreamParameters*, PaStreamParameters*, double, uint, 
uint, extern (C) int function(const(void)*, void*, uint, 
const(PaStreamCallbackTimeInfo)*, uint, void*), void*)

--------------

The only difference I see is in const(PaStreamParameters*) but I 
feel like every time I pass a non-const argument where a const is 
required, the conversion should be implicit. At least, that's the 
way I seem to recall it working.

What am I doing wrong?
Oct 07 2014
parent reply "Vlad Levenfeld" <vlevenfeld gmail.com> writes:
Update: I just did a manual cast. Still getting there error. 
Here's the new argument lists:

(void**, const(PaStreamParameters*), const(PaStreamParameters*), 
double, uint, uint, extern (C) int function(const(void)*, void*, 
uint, const(PaStreamCallbackTimeInfo)*, uint, void*), void*)

(void**, const(PaStreamParameters*), const(PaStreamParameters*), 
double, uint, uint, extern (C) int function(const(void)*, void*, 
uint, const(PaStreamCallbackTimeInfo)*, uint, void*), void*)

They're identical... unless I'm losing my mind. Yet still its 
"not callable using argument types"
Oct 07 2014
next sibling parent "Nimrod okoudcsharp" <nim nowhere.bla> writes:
On Tuesday, 7 October 2014 at 19:15:31 UTC, Vlad Levenfeld wrote:
 Update: I just did a manual cast. Still getting there error. 
 Here's the new argument lists:

 (void**, const(PaStreamParameters*), 
 const(PaStreamParameters*), double, uint, uint, extern (C) int 
 function(const(void)*, void*, uint, 
 const(PaStreamCallbackTimeInfo)*, uint, void*), void*)

 (void**, const(PaStreamParameters*), 
 const(PaStreamParameters*), double, uint, uint, extern (C) int 
 function(const(void)*, void*, uint, 
 const(PaStreamCallbackTimeInfo)*, uint, void*), void*)

 They're identical... unless I'm losing my mind. Yet still its 
 "not callable using argument types"
Have you tried the switch -vcolumn ? Maybe it'll point the location of the problem in a more accurate way. Just an idea.
Oct 08 2014
prev sibling parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 10/7/14 3:15 PM, Vlad Levenfeld wrote:
 Update: I just did a manual cast. Still getting there error. Here's the
 new argument lists:

 (void**, const(PaStreamParameters*), const(PaStreamParameters*), double,
 uint, uint, extern (C) int function(const(void)*, void*, uint,
 const(PaStreamCallbackTimeInfo)*, uint, void*), void*)

 (void**, const(PaStreamParameters*), const(PaStreamParameters*), double,
 uint, uint, extern (C) int function(const(void)*, void*, uint,
 const(PaStreamCallbackTimeInfo)*, uint, void*), void*)

 They're identical... unless I'm losing my mind. Yet still its "not
 callable using argument types"
I would suggest removing each parameter from the function prototype and call, until you find the culprit. Then put everything else back in. Try moving the parameters around. Yes, the compiled code won't work, but this looks to me like a compiler bug (at least a diagnostic issue), and it will help narrow down a simple case you can submit. -Steve
Oct 08 2014