1 Jun 2009 16:46
PHP argout question, std_string.i improvements
David Fletcher <frodo <at> tuscanyda.com>
2009-06-01 14:46:42 GMT
2009-06-01 14:46:42 GMT
Hi all,
I have a C++ function that directly returns a bool, but also returns a
string using the OUTPUT/argout machinery:
%apply std::string* OUTPUT { std::string* output_value };
class Attributes
{
public:
bool FindValue(const std::string& key,
std::string* output_value) const;
...
This doesn't work, because the std_string.i interface file (in the
Lib/php directory of the SWIG distribution) appears to lack typemaps
for argout, etc. I've enhanced this file and have included it below.
I'd appreciate any feedback on this. Does anyone see any errors?
While this generates C++ code that compiles, the interface doesn't
work. I believe this is because an array isn't generated for the
FindValue() function (which now returns multiple values).
>From looking at the Source/Modules/php.cxx file, I don't see any
support for handling multiple return values. Presuming my analysis is
correct, I'd like to start adding support for this.
I do have a question: what's the simplest way to determine how many
values are returned by a function? Is there an attribute that can be
(Continue reading)
RSS Feed