<div dir="ltr"><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hi, We are trying to use SWIG 1.3.36 with perl&nbsp; 5.8.8 and the Visual Studio C++ 2005 compiler. The header file used in our mdMatchup.i file is shown below. In our mdMatchup.i&nbsp;, we are using the module mdMatchupTest. We ran swig -c++ -perl mdMatchup.i and obtained mdMatchup.pm and mdMatchup_wrap.cxx.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;We read that SWIG Perl can handle C++ enumerations. But, when we use the enumerations in our test.pl program:<br>&nbsp;<br>#!perl.exe -w<br>use strict;<br>use mdMatchupTest;<br><br>my $readwrite;<br>$readwrite = mdMatchupTestc::new_mdMUReadWrite();<br>
&nbsp;<br>mdMatchupTestc::mdMUReadWrite_SetLicenseString($readwrite,&quot;LL58JH2Y&quot;);<br>mdMatchupTestc::mdMUReadWrite_SetPathToMatchUpFiles($readwrite,&quot;C:\\MatchupAPI\\Distribution&quot;);<br>if (mdMatchupTestc::mdMUReadWrite_InitializeDataFiles($readwrite) != $mdMatchupc::mdMUReadWrite_NoError ){<br>
&nbsp;print( &quot;Failed to Initialize mdMatchupTestc::mdMUReadWrite &quot;,<br>&nbsp;&nbsp;mdMatchupTestc::mdMUReadWrite_GetInitializeErrorString($readwrite). &quot;\n&quot;);<br>}&nbsp;<br><br>we get the&nbsp;Perl interprepter&nbsp;message :&nbsp;Name &quot;mdMatchupc::mdMUReadWrite_NoError&quot; used only once: possible typo at test.pl line 10<br>
Use of uninitialized value in numeric ne (!=) at test.pl line 10.&nbsp;</div>
<div>&nbsp;&nbsp;When we examine&nbsp;the mdMatchup.pm, &nbsp;we&nbsp;see that mdMatchupc::mdMUReadWrite_NoError looks like a string. An excerpt of mdMatchup.pm is shown below. </div>
<div>&nbsp; Is there a correct way to use&nbsp;SWIG packages&nbsp;with C++ enumerations in our perl program? Thank you.</div>
<div>-------------------------------------mdMatchup.pm---------------------------------</div>
<div>############# Class : mdMatchupTest::mdMUReadWrite ##############</div>
<div>package mdMatchupTest::mdMUReadWrite;<br>use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);<br>@ISA = qw( mdMatchupTest );<br>%OWNER = ();<br>%ITERATORS = ();<br>*NoError = *mdMatchupTestc::mdMUReadWrite_NoError;<br>
*ConfigFile = *mdMatchupTestc::mdMUReadWrite_ConfigFile;</div>
<div>-------------------------------------mdMatchup.h------------------------------------<br><font color="#0000ff" size="2">#if</font><font color="#000000" size="2"> !</font><font color="#0000ff" size="2">defined</font><font size="2"><font color="#000000">(MDMATCHUP_H)</font><br>
</font><font color="#0000ff" size="2">#define</font><font size="2"><font color="#000000"> MDMATCHUP_H</font><br></font><font color="#0000ff" size="2">#if</font><font color="#000000" size="2"> !</font><font color="#0000ff" size="2">defined</font><font size="2"><font color="#000000">(MDAPI)</font><br>
</font><font color="#808080" size="2">#if defined(_WIN32) || defined(_WIN64)<br>#define MDAPI __declspec(dllimport)<br>#else<br>#define MDAPI<br>#define __stdcall<br>#endif<br></font><font color="#0000ff" size="2">#endif</font><font size="2"><br>
</font><font color="#008000" size="2">/*<br>* C++ version of interface<br>*/<br></font><font size="2"><br></font><font color="#0000ff" size="2">class</font><font size="2"><font color="#000000"> MDAPI mdMUReadWrite</font><br>
{<br></font><font color="#0000ff" size="2">protected</font><font size="2"><font color="#000000">:</font><br></font><font color="#0000ff" size="2">struct</font><font size="2"> mdMUReadWrite_ *I;<br></font><font color="#0000ff" size="2">private</font><font color="#000000" size="2">: </font><font color="#008000" size="2">/* disable implicit constructor and assignment */<br>
</font><font size="2">mdMUReadWrite(mdMUReadWrite &amp;X);<br>mdMUReadWrite&amp; </font><font color="#0000ff" size="2">operator</font><font size="2">=(mdMUReadWrite &amp;X);<br></font><font color="#0000ff" size="2">public</font><font size="2"><font color="#000000">:</font><br>
</font><font color="#0000ff" size="2">enum</font><font size="2"> ProgramStatus {<br>NoError=0,<br>ConfigFile=1,<br>LicenseExpired=2,<br>DatabaseExpired=3<br>};<br></font><font size="2"><br>mdMUReadWrite();<br>~mdMUReadWrite();<br>
<br></font><font color="#008000" size="2">/* Setup methods */<br></font><font size="2"></font><font color="#0000ff" size="2">void</font><font size="2"> SetPathToMatchUpFiles(</font><font color="#0000ff" size="2">const</font><font size="2"> </font><font color="#0000ff" size="2">char</font><font size="2"> *Path);<br>
</font><font color="#0000ff" size="2">void</font><font size="2"> SetMatchcodeName(</font><font color="#0000ff" size="2">const</font><font size="2"> </font><font color="#0000ff" size="2">char</font><font size="2"> *MatchcodeName);<br>
</font><font color="#0000ff" size="2">void</font><font size="2"> SetMatchcodeObject(mdMUMatchcode *Matchcode);<br></font><font color="#0000ff" size="2">void</font><font size="2"> SetKeyFile(</font><font color="#0000ff" size="2">const</font><font size="2"> </font><font color="#0000ff" size="2">char</font><font size="2"> *KeyFile);<br>
</font><font color="#0000ff" size="2">enum</font><font size="2"> ProgramStatus InitializeDataFiles();<br></font><font color="#0000ff" size="2">const</font><font size="2"> </font><font color="#0000ff" size="2">char</font><font size="2"> *GetInitializeErrorString();<br>
</font><font color="#0000ff" size="2">void</font><font size="2"> Initialize(</font><font color="#0000ff" size="2">void</font><font size="2">);<br></font><font color="#0000ff" size="2">int</font><font size="2"> SetLicenseString(</font><font color="#0000ff" size="2">const</font><font size="2"> </font><font color="#0000ff" size="2">char</font><font size="2">*);<br>
</font><font size="2">}<br></font><br></div></div>