Swig ignores typedef (Swig-Python)

View: New views
1 Messages — Rating Filter:   Alert me  

Swig ignores typedef (Swig-Python)

by Zina :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

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


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user