From: Zinaida K. <zk...@br...> - 2008-06-02 20:17:35
|
Hello, I am a new to Swig and Python. I have a problem with typedef. I don't see where I am doing wrong or Swig ignores typedef. Here is what I have: /// \file bvTypes.h /// \brief File description here. #pragma once #ifdef __cplusplus extern "C" { #endif typedef struct { double x; double y; double z; double w; } BvVector; typedef BvVector BvPoint; typedef struct { BvPoint* point; int fillSize; int allocSize; } BvPoints; #ifdef __cplusplus } #endif /* file bvl.i*/ %module BVL %{ /* Include in the generated wrapper file */ #include "Include/bvTypes.h" #include "Include/bvError.h" %} /* Tell SWIG about it */ typedef struct { /// Put a member description here. double x; /// Put a member description here. double y; /// Put a member description here. double z; /// Used as homogeneous coordinate. double w; } BvVector; enum BvError { BvErrorOk, BvErrorMemoryAllocation, BvErrorInvalidArg, BvErrorSizeLimit, BvErrorCameraCalibration, BvErrorCalcXform, BvErrorCreatePattern, BvErrorMatchPattern, BvErrorFindCircles, BvErrorCreateContour, BvErrorMatchContour, BvErrorOrderCalibrationPoints, }; BvError bvCreatePoints(const int allocSize, BvPoints** points); BvError bvAddPoint(const BvPoint* point, BvPoints* points); BvError bvResetPoint(BvPoint* point); BvError bvReleasePoints(BvPoints* points); typedef struct { /// Put a member description here. BvPoint* point; /// Put a member description here. int fillSize; /// Put a member description here. int allocSize; } BvPoints; typedef BvVector BvPoint; In Python I get an error: E:\Python25>Python Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 win32 Type "help", "copyright", "credits" or "license" for more infor >>> import BVL >>> point=BVL.BvPoint Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'BvPoint' >>> I am using Python25, Swig-1.3.35 and MS Visual Studio2005 Please help me. Zina |