<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
OK, so now I have:<br>
<br>
In SolveSAC_Wrap.pyx:<br>
<br>
<b># Pyrex wrapper for SolveSAC<br>
<br>
import BMMain as BMM<br>
<br>
test_vals = BMM.BMGlobalInputsWrapper()<br>
test_vals.getAllInputs("/Users/dg/Documents/NOAA/Projects/BaroModes/software/BMS<br>
ettingsFile.asc")<br>
<br>
def GetNumVertices():<br>
&nbsp;&nbsp;&nbsp; return _GetNumVertices()<br>
<br>
cdef public long _GetNumVertices():<br>
&nbsp;&nbsp;&nbsp; if test_vals.nodes: <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return test_vals.d.getNrows()<br>
<br>
</b>and in run_SolveSAC_Wrap.py:<br>
<br>
<b>import SolveSAC_Wrap as SSW<br>
<br>
print SSW.GetNumVertices()<br>
</b><br>
and I still get:<br>
<br>
$ python run_SolveSAC_Wrap.py<br>
Traceback (most recent call last):<br>
&nbsp; File "run_SolveSAC_Wrap.py", line 1, in &lt;module&gt;<br>
&nbsp;&nbsp;&nbsp; import SolveSAC_Wrap as SSW<br>
ImportError: dynamic module does not define init function
(initSolveSAC_Wrap)<br>
<br>
DG<br>
Francesc Altet wrote:
<blockquote cite="mid1181150414.3560.49.camel@localhost" type="cite">
  <pre wrap="">El dc 06 de 06 del 2007 a les 09:52 -0700, en/na David Goldsmith va
escriure:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Francesc Altet wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">[Please always reply to the list so that other people and help/learn
to/from you]
  
      </pre>
    </blockquote>
    <pre wrap="">Sorry, I thought I did (I usually do) but I guess I forgot to this time. :-)
    </pre>
    <blockquote type="cite">
      <pre wrap="">The problem is that you have defined GetNumVertices() as 'cdef' function
instead of 'def'.  'cdef' is the way to declare C functions but these
will not be callable from Python. Try this:
  
      </pre>
    </blockquote>
    <pre wrap="">What if I want it to be callable from both?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
In that case, you can do a wrapper in the next way:

def GetNumVertices():
    return _GetNumVertices()    

cdef public long _GetNumVertices():
    if test_vals.nodes:
        return test_vals.d.getNrows()

If you want to call from Python, call GetNumVertices(). If you want to
call the function from C, then call _GetNumVertices().

Cheers,

  </pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>NOAA signature</title>
<meta name="author" content="David L Goldsmith">
<a href="http://response.restoration.noaa.gov/emergencyresponse/">ERD/ORR/NOS/NOAA</a>
</div>
</body>
</html>