liam mail | 4 Dec 02:46

Re: How can base class pointers to a derived object be used as a derived object pointer?

2008/12/4 James Masters <james.d.masters <at> gmail.com>:
> Hi all,
>
> First off, I'm fairly new to both C++ and SWIG so I apologize ahead of time
> if something is wrong with my examples or if this is a newbie question.  I'm
> at a bit of a loss as to how to even form my question, so maybe I'll just
> explain what I'm trying to accomplish using a simplified example.
>
> I have the following classes where I have a "definition" class for a polygon
> (PolygonDef) and a rectangle (Rect which derives from PolygonDef).
> Furthermore, I have a Rect class that constructs with a RectDef object
> reference as an argument.  So the headers would be as follows:
>
> /******************** inhtest.h ********************/
>
> //// HEADERS ////
>
> class PolygonDef {
>  public:
>   static PolygonDef * find();
> };
>
> class RectDef : public PolygonDef {};
>
> class Rect {
> public:
>   int data;
>   Rect(int);
>   static Rect * create(const RectDef &rd);
> };
(Continue reading)

Mark Elston | 4 Dec 02:40

%csmethodmodifiers not working

I have a class that inherits from a base class.  Both
classes have a "getType" method (defined as virtual in the
base class).  I have added the following line to my SWIG
interface file:

  %csmethodmodifiers Derived::getType() "override";

where "Derived" is the name of the derived class.

However, the generated C#code doesn't apply the "override" to
the getType method of the derived class.  Whether the above line
is present or not the results are identical.

Is there some way to get the override to work for C#?

Mark

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Gabor Greif | 27 Nov 09:10

Tcl cprint for C structs

Hi all,

I had the need to print all members of a C struct in one
go.

So I have implemented, a "cprint" method for structure
commands in the TCL backend.

Example:

struct whum {
  int foo;
  char* bar;
};

Generates this TCL functionality:

whum it

it configure -foo 42 -bar hey

puts [it cprint]
---> "-foo 42 -bar hey"

Anyone interested in a patch? Is it a good idea
to put something like this into the general distro?

Cheers,

	Gabor
(Continue reading)

Ben Webb | 3 Dec 02:59
Favicon

Bug in SWIG 1.3.35 with std::vector type system?

I have encountered a problem with SWIG 1.3.35 and later with a fairly
simple usage of std::vector. (I have opened a bug on the tracker
containing the same information, #2380788.) What seems to be happening
is that the SWIG runtime is getting confused about the type of the
std::vector.

For example, running 'make' with the following Makefile and test.i works
(produces no output from Python) with SWIG 1.3.34, but fails on SWIG
1.3.35, 1.3.36 and SVN r10960 with the error:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "test.py", line 130, in insert
    def insert(self, *args): return _test.vectorf_insert(self, *args)
NotImplementedError: Wrong number of arguments for overloaded function
'vectorf_insert'.
  Possible C/C++ prototypes are:
    insert(std::vector< float > *,std::vector< float
>::iterator,std::vector< float >::value_type const &)
    insert(std::vector< float > *,std::vector< float
>::iterator,std::vector< float >::size_type,std::vector< float
>::value_type const &)

Obviously this makes STL vectors rather hard for us to use in practice!

I ran into the problem with Fedora 10's package of SWIG 1.3.35 (Fedora
9's build of 1.3.33 works just fine) but confirmed that it also fails
for me with 1.3.35 built from your upstream sources. (But ideally a
backport of any fix to 1.3.35 would be useful, so that Fedora can patch
their package without having to upgrade to an SVN snapshot.)

(Continue reading)

julien CLEMENT | 1 Dec 19:37

Perl Export

%perlcode:

Ok, nice idea. Nevertheless, I'd have to export manually all the symbols when it could have been done
automatically, which I expect SWIG to do ...

See you

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
julien CLEMENT | 1 Dec 17:38

Perl Export (2)

Hi all,

I'm new to SWIG. I'm using it to interface Perl and C.
I've noticed that the generated .pm did not export the symbols:

<at> EXPORT = qw ();

Thus, it forces a client program to prefix each symbol with the name of the package or
to do a "pakage <name>;"
If a program uses more than one package, it can be messy to switch between the namespaces.

Is there a way to force the export of the Perl symbols in the generated .pm ?

Many thanks
Julien CLEMENT.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
Rich E | 28 Nov 23:04

converting c float array to numpy array or python list

Hi all,

So I have a nice C library wrapped in python and I'd like to start
doing some plots of things in python... the problem is the data is all
stuck in C arrays.  I'm sure this is a common problem, but I have not
found an elegant solution.  Right now I have a help function that will
return one member of the C array, such as:

%inline %{

        float getFloat(float *array, int index)
        {
                return array[index];
        }
        %}

But how would I go about returning a python list of the entire array,
or even better, an NumPy array?

My thoughts are that I will have to convert between C arrays and
python types (list or NumPy) quite often, probably at a refresh rate
suitable for animation. Any advice?

regards,
Rich

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Bilger, Matthias | 28 Nov 13:00

Re: Welcome to the "Swig-user" mailing list

Hi,

I have to use a DLL from Java using JNI (JNA will not work < Java 1.4). So I have to write a WrapperDLL offers me a
JNI Interface to the DLL. The problem is a function like this:

int myProblemFunction(int inInt, myStruct** mst)

The struct looks like this:

typedef struct _mStruct{
	int var1;
	int var2;
	void* pointer;
} myStruct;

Is the only way to get the function working (using SWIG) to write a typemap? Or is there an easy to use solution
for this problem?

BTW: what would you call mst? Doublepointer?

Thanks a lot,
Best regards
Matthias Bilger

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Sze Wan Lim | 28 Nov 03:31

Unable to find 'std_iostream.i'

Hi!
 
I am wrapping my C++ to C# interface. I tried to use the iostream library. I have check into my lib folder and std_iostream.i is available but I get error saying 'Unable to find 'std_iostream.i'. Did anyone face this problem before? Any solution to this?
 
In ReadFile.H
#include <iostream>
 
class ReadFile
{
public:
  
    ReadFile(
     ostream& logFileStream,
     ostream& stdOutStream);
 
}
 
in ReadFile.i
%module MyReadFile
 %{
 #include "ReadFile.H"
 %}
  
 %include "std_iostream.i"
 %include "ReadFile.H"
 
 Thanks!
 
SW
 
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
Michael Leong | 27 Nov 00:08

Installing SWIG on AIX with xlc

Greetings,

I'm trying to install SWIG on an AIX 5.3 machine with the xlc
compiler. I've unzipped the package, and then I give the ./configure
CC=xlc command, which works just fine. However, when I run make, I get
the following errors:

        make  all-am
        source='CParse/cscanner.c' object='CParse/cscanner.o' libtool=no  DEPDIR
=.deps depmode=aix /bin/sh ../Tools/config/depcomp  /usr/vacpp/bin/xlC_r -DHAVE_
CONFIG_H      -I../Source/Include        -I../Source/CParse      -I../Source/Inc
lude             -I../Source/DOH                 -I../Source/CParse
 -I../Source/Preprocessor        -I../Source/Swig                -I../Source/Mod
ules -g -Wall -W -ansi -pedantic -c -o CParse/cscanner.o CParse/cscanner.c
/usr/vacpp/bin/xlC_r: 1501-210 (S) command option Wall contains an incorrect sub
argument
make: 1254-004 The error code from the last command is 40.

Stop.
make: 1254-004 The error code from the last command is 2.

Stop.
make: 1254-004 The error code from the last command is 2.

Stop.

I notice that it's trying to use the -Wall option, which is a gcc
option that is not recognized by xlc. Has anyone encountered this
problem before, or done anything fancy to get SWIG installed on AIX?
Any help would be appreciated.

Thanks.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
David Piepgrass | 26 Nov 17:23

Re: can %include include more than once?

I don't think that's possible.

You could probably use SWIG's nifty multiline macros as a substitute, by
putting put the contents of your include file inside of a big macro and
then invoking the macro repeatedly.

> -----Original Message-----
> From: Patrick M. [mailto:meierpatrick <at> ymail.com]
> Sent: Wednesday, November 26, 2008 7:56 AM
> To: swig-user <at> lists.sourceforge.net
> Subject: [Swig-user] can %include include more than once?
> 
> 
> The manual http://www.swig.org/Doc1.3/Preprocessor.html explains:
> "Unlike, #include, %include includes each file once (and will not
reload
> the
> file on subsequent %include declarations). Therefore, it is not
necessary
> to
> use include-guards in SWIG interfaces."
> 
> Although this behavior may be nice in most cases, I have a situation
where
> I
> must include a swig file several times in different places of a bigger
> project (the included swig file contains several #define's that are
> #undef'd
> later and #define'd again in a different place.)
> 
> Is there some option (or a different swig directive) to include a swig
> file
> more than once?
> 
> Thank you
> Patrick
> --
> View this message in context:
http://www.nabble.com/can--include-include-
> more-than-once--tp20702442p20702442.html
> Sent from the swig-user mailing list archive at Nabble.com.
> 
> 
>
------------------------------------------------------------------------
-
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Swig-user mailing list
> Swig-user <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/swig-user

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Gmane