Hi,

I'm trying to use swig to generate python wrappers to a custom binary package that my research group uses. I'm new to swig, but I must say I'm very impressed. The only hang-up I have left is that I have trouble directly accessing the global array data. I've currently hacked this by writing a function to return the array data. I.e:

int getArrayDataInt(int *array, int i){
    return array[i];
}

But, I would be much happier if I could somehow override the python []'s or otherwise access this directly. I've tried typemaps, but they seem to only work when thing are passed through functions.

In this package, everything is global, because is/was used with fortran (i.e. they because fortran common blocks).

I would love to get this cleaner. Please let me know if you have some experience with swig. I'm personally pretty to both this and python.

Thank you,

Elliott

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.