<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
In C/C++, I believe this problem would be solved like this:<br>
<br>
<b>**matrix.h**</b><br>
#ifndef MATRIX_H<br>
#define MATRIX_H<br>
<br>
/* declarations here */<br>
#endif<br>
<br>
<b>**matrix.c**</b><br>
#include "matrix.h"<br>
<br>
/* implementation here */<br>
<br>
Is there an equivalent to #ifndef in Pyrex?&nbsp; Or is there any other
solution to my problem?<br>
<blockquote cite="mid4488E7F3.4030903@wi.rr.com" type="cite">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
I'm building a little math library in Pyrex, and I'm having trouble
with some circular cimports.&nbsp; I'll post short excerpts from my various
files, then show the error that I'm getting when I try to use one of
the modules.<br>
  <br>
  <b>**matrix.pxd**<br>
  </b>cdef class Matrix:<br>
&nbsp;&nbsp;&nbsp; cdef float m[4][4]<br>
  <br>
  <b>**matrix.pyx**<br>
  </b>cimport vector<br>
  <br>
cdef class Matrix:<br>
&nbsp;&nbsp;&nbsp; ### a bunch of methods, including ones that create or manipulate
Vector objects ###<br>
  <br>
  <b>**vector.pxd**<br>
  </b>cdef class Vector:<br>
&nbsp;&nbsp;&nbsp; cdef float x, y, z, w<br>
  <br>
  <b>**vector.pyx**</b><br>
cimport matrix<br>
  <br>
cdef class Vector:<br>
&nbsp;&nbsp;&nbsp; ### a bunch of methods, including one that has a Matrix argument ###<br>
  <br>
After building the Pyrex modules into .pyd files, I run a test module.&nbsp;
The first line imports the matrix module and throws this error:<br>
  <br>
Traceback (most recent call last):<br>
&nbsp; File "C:\Development\SFStratPrototype\math3d\matrixTest.py", line 1,
in ?<br>
&nbsp;&nbsp;&nbsp; import matrix<br>
&nbsp; File "vector.pxd", line 1, in matrix<br>
&nbsp;&nbsp;&nbsp; cdef class Vector:<br>
&nbsp; File "matrix.pxd", line 1, in vector<br>
&nbsp;&nbsp;&nbsp; cdef class Matrix:<br>
AttributeError: 'module' object has no attribute 'Matrix'<br>
Press any key to continue . . .<br>
  <br>
It doesn't seem to like how the modules cimport each other.&nbsp; I can't
see any way to eliminate this circular reference, so what can I do to
fix this error?<br>
  <br>
- Mike Wyatt<br>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Pyrex mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Pyrex@lists.copyleft.no">Pyrex@lists.copyleft.no</a>
<a class="moz-txt-link-freetext" href="http://lists.copyleft.no/mailman/listinfo/pyrex">http://lists.copyleft.no/mailman/listinfo/pyrex</a>
  </pre>
</blockquote>
</body>
</html>