Here's what I tried:

%module rfdef
#include "../../inc/rfdef.h"
%include "../../inc/rfdef.h"

%include typemaps.i
int RFDef::RfName(const char *, BldID *OUTPUT, unsigned *OUTPUT, unsigned *OUTPUT);

Things compile and link fine. As I understand it, when I use this in perl, the output arguments will show up in the output array.

But, I can't get the subroutine to work in perl...what am I doing wrong?

Here's the error:
ValueError invalid null reference in method 'RfName', argument 2 of type 'RFdef::DldID &

Here's the perl:

my $name = "1L17-2" #the only real argument to the function. The rest are output.
my ($id,$modindex,$cavindex);

my $result = rflib::rfName($name,$id,$modindex,$cavindex);
print "RESULT: ", $result, "\n";


On 1/29/2011 11:26 AM, William S Fulton wrote:
On 28/01/11 20:12, Michele Joyce wrote:
I'm sure that the solution to my problem involves typemaps...but my
typemap knowledge is limited.

In the C++ code:

typedef  enum  {Injector  <http://devweb/controls_web/certified/rflib/html/namespaceRFdef.html#a27a9>=0,NorthLinac  <http://devweb/controls_web/certified/rflib/html/namespaceRFdef.html#a27a10>,SouthLinac  <http://devweb/controls_web/certified/rflib/html/namespaceRFdef.html#a27a11>,BldCount  <http://devweb/controls_web/certified/rflib/html/namespaceRFdef.html#a27a12>  }BldID  <http://devweb/controls_web/certified/rflib/html/namespaceRFdef.html#a27>;


//This subroutine will assign the BldID value to the argument as output.
int RfName(const char *, BldID&, unsigned&, unsigned&)

When I try to call the subroutine in perl, the wrapper code expects an argument of type BldID...

Is this an example of where an "argout" typemap should be used?
Indeed, I haven't looked to see how to code this up for perl, but take a look at the int OUTPUT typemaps in typemaps.i for inspiration.