From: Arjen M. <arj...@wl...> - 2006-07-03 10:07:21
|
lan...@qw... wrote: >Hi list, > >Sorry to bother with such a trivial question that should properly be >asked elsewhere, but maybe you'll humor me. > >I'm making some serious progress as a spare-time project in making >Ada bindings for PLplot, and some of the examples are working well. >Here's my dumb C question: If there is a C procedure such as > >void plfoo(PLFLT *bar); > >how does one tell if the parameter is intended to be a pointer to an >array of PLFLT or whether it is simply a scalar (single number) PLFLT >that is being passed by reference? Am I missing something here? Will >I have to consult the API reference for each function to discover >what is intended if it's not obvious otherwise? > > Unfortunately, C does not make any distinction between the two cases you mention. So, indeed, you will have to consult the documentation instead (and ultimately even the source code for that particular function). You may find it useful to look at the Fortran 90/95 interface, because for that interface we had to solve the same (or at least a similar) problem. We have not used the INTENT(IN/OUT) attribute there, because it might interfere with the way C expects the arguments to be passed, but at least it will give you a way other than the documentation of identifying which are scalar and which are array arguments. PLplot has a helpful naming convention: plg - for functions that return attributes pls - for functions that set attributes Regards, Arjen |