Juan Manuel Alvarez | 1 Aug 21:27 2009
Picon

Keeping C# generated files up to date

Hello everyone! I have an issue I hope someone has already solved.

I am wrapping to C# a .h file with some structs: MyStruct1, MyStruct2
and MyStruct3.
This generates a module .cs file and three other files: MyStruct1.cs,
MyStruct2.cs and MyStruct3.cs.

The thing happens when I change the .h file, deleting one struct and
adding another. For example, I delete MyStruct2 and add MyStruct4.
This causes the module file to change, but does not cause the
MyStruct2.cs file to be deleted, generating an inconsistency.

I don't want to delete all the .cs files in the folder, since that
would cause me to regenerate all the wrappers again, even the ones
that did not change.
I reviewed all the command line options, but I couldn't find any that helped.
One solution would be to generate a .cs file for each .i, but I also
couldn't find how to do that.

Is there a way I can keep the .cs files syncronized with the wrappers?

Thanks in advance
Juan M.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
(Continue reading)

Jose Acain | 4 Aug 01:28 2009
Picon

Unknown Dynamic Linking Problem


After trying to run the simple (gcd) program example that came with the install, i've come across an error
that is not one of the common "unsatisfied linking errors" encountered or even talked about in the manual. 
The error is below:

Exception in thread "main" java.lang.UnsatisfiedLinkError: gdpswigtest.exampleJNI.gcd(II)I
        at gdpswigtest.exampleJNI.gcd(Native Method)
        at gdpswigtest.example.gcd(example.java:12)
        at gdpswigtest.Main.main(Main.java:22)

I am using a linux machine running CENT OS 5.3 and developing using Java NetBeans. I have used the standard
interface file and main file that came with the simple program and was unable to get it running.  Any help is
appreciated and let me know if the source files are needed.

Thanks!!!

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Adam A Smith | 4 Aug 02:06 2009
Picon

Swig Objects in Python

Another couple of SWIG/Python questions:

I have a method that I've wrapped in my bpp module, called 
TextTools.split().  It takes a string and an integer, and then splits the 
string into that many (roughly) equal substrings.  However, the original 
code returned a C++ vector.  Here's what I get when I call it:

>>> bpp.TextTools.split("abcd", 2)
swig/python detected a memory leak of type 'std::vector< std::string > *', no destructor found.
<Swig Object of type 'std::vector< std::string > *' at 0x8ad1818>

First question--what's up with the memory leak?  Doesn't std::vector have 
a destructor somewhere?

Second question--how can I access the objects within the vector?  Using 
help() within Python, I've found a few methods that the Swig Object has. 
But the only one that seems useful is __getattribute__, and that doesn't 
seem to work for me:

>>> x = bpp.TextTools.split("abcd", 2)
>>> x.__getattribute__('size')
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
AttributeError: 'PySwigObject' object has no attribute 'size'

Can anyone help?

Thanks,
Adam

(Continue reading)

Bob Hood | 4 Aug 03:22 2009
Picon
Picon

C++ documentation to Python docstrings

Has an elegant way yet been added to SWIG to extract C++ class documentation (in the form of some type of comment) into a Python docstring for the generated shadow class?  I've seen the doxy2swig.py script, but I was wondering if anything had be implemented directly within SWIG itself since that was created?


Render me gone, ||| Bob ^(===)^ ---------------------------------oOO--(_)--OOo--------------------------------- "If ya can't beat 'em, tariff 'em." - Harley-Davidson Motor Company
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
John Heisey | 4 Aug 04:31 2009

Director and supporting multiple languages

I'm trying to build both Java and C# language bindings into the same DLL.

* I have a class called StreamNotifications which provides a way to implement a call back mechanism by
overriding the class function Notify().
* I use swig to create two sets of _wrap.cpp and _wrap.h. One set for Java and one set for Csharp.
* Each _wrap.cpp constains the generated class SwigDirector_StreamNotifications which causes a
conflict during linking.
* The two invocations of swig have the command line parameters.

  swig -Wall -outdir .\src\com\synaptics\crocodile\interfaces -c++
       -java -package com.synaptics.crocodile.interfaces
       -o CdciControllerInterfaces_java_wrap.cpp
       c:\Projects\tools\CDCI\CDCIApi\Bindings\CdciControllerInterfaces.i

  swig -Wall -outdir .\src\com\synaptics\crocodile\interfaces -c++
       -csharp -dllimport CdciApi.dll -namespace Synaptics
       -o CdciControllerInterfaces_csharp_wrap.cpp
       c:\Projects\tools\CDCI\CDCIApi\Bindings\CdciControllerInterfaces.i

I'm not sure how what direction to go to resolve this. And what if I want to add the bindings for Perl?

Thanks,
J.R. Heisey
Sr. Software Engineer
Synaptics, Inc.
3120 Scott Blvd.
Santa Clara CA 95054
+1 408 454-5373
jrheisey <at> synaptics.com
www.synaptics.com

Enriching the Interaction between humans and intelligent devices

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Dheeraj Joshi | 4 Aug 17:10 2009
Picon

PHP help

I already posted mail here. But no reply...
 
Anyways i am posting it again.
 
My project has a peculiar requirement where i need to call a C function through php file.
 
For understanding puepose.
I used the example in Swig tutorial
 
and tried to compile it for php..
 
But it is giving following error.
 
Warning: dl(): Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/example.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/example.so: cannot open shared object file: No such file or directory in /var/www/html/example.php on line 22
Fatal error: Call to undefined function fact() in /var/www/html/test.php on line 8
 
Why is this error?
 
Can some one assist me?
 
Regards
Dheeraj
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
William S Fulton | 4 Aug 20:22 2009
Picon

Re: Status of SWIG_TypeDynamicCast?

Brian Cole wrote:
> The only reference to SWIG_TypeDynamicCast I can find is in the ChangeLog for the 1.3.12 release.
However, it appears to be a very useful feature for writing an output typemap that automatically casts a
base class pointer to it's actual class. Really useful for dynamic typed languages, specifically, for
implementing __copy__ and __deepcopy__ for Python. I have a C++ base class that defines a pure abstract
CreateCopy method like the following:
> 
> class Base {
>  Base *CreateCopy() const = 0;
> };
> 
> Then a bunch of classes that derive from this Base class that I would like to enable the deepcopy protocol by
defining a __deepcopy__ method that simply calls CreateCopy. However, to be useful to Python that have to
be dynamically cast to whatever their concrete class is. 
> 
> The idiom in the ChangeLog works well, but it has an annoying feature hole that has to be non-trivially
programmed around. I have to manually write the dynamic cast functions, this is standard boiler plate
code that SWIG should be able to generate for me since it knows the class hierarchy. This problem is
expounded when dealing with cross-module hierarchies since now I have to register classes that the base
class can be cast into. 
> 
> So why not always initialize the dcast field of the swig_type_info struct? Should be somewhat trivial for
SWIG to construct these functions for me. Or is there a deep reason why this feature was not pushed forward
in favor of something else? 
> 
> Also, the ChangeLog alludes to problems with Java and CSharp, why can't this be done in those languages? 
SWIG_TypeDynamicCast requires the SWIG runtime type system used by the 
scripting languages. Java and C# are statically typed languages and so 
do not use the dynamic runtime type system as the static typing of the 
language is used instead. Sorry, but I'm not sure about your other 
queries without spending time looking at it.

William

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Miklos Vajna | 5 Aug 01:29 2009
Picon

Re: PHP help

On Tue, Aug 04, 2009 at 08:40:56PM +0530, Dheeraj Joshi <dheeraj <at> tataelxsi.co.in> wrote:
> But it is giving following error.
> 
> Warning: dl(): Unable to load dynamic library
'/usr/local/lib/php/extensions/no-debug-non-zts-20090626/example.so' -
/usr/local/lib/php/extensions/no-debug-non-zts-20090626/example.so: cannot open shared object
file: No such file or directory in /var/www/html/example.php on line 22
> Fatal error: Call to undefined function fact() in /var/www/html/test.php on line 8

Does the file named
'/usr/local/lib/php/extensions/no-debug-non-zts-20090626/example.so'
exist?

What is the C source and the SWIG interface file you tried use? What
commands did you use?
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
Olly Betts | 5 Aug 04:12 2009

Re: PHP help

On 2009-08-04, Dheeraj Joshi <dheeraj <at> tataelxsi.co.in> wrote:
> I already posted mail here. But no reply...

I replied:

http://thread.gmane.org/gmane.comp.programming.swig/14834/focus=14835

Cheers,
    Olly

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
William S Fulton | 5 Aug 07:43 2009
Picon

Re: Smart pointers & typedefs

Juan Manuel Alvarez wrote:
> Hello everyone!
> 
> I am having a problem wrapping a smart pointer defined with a typedef
> like follows:
> typedef boost::shared_ptr<Category> CategoryPtr;
> 
> In my C++ code I am using CategoryPtr like a type like this:
> CategoryPtr getCategory (int i);
> 
> The problem is: no matter how I use SWIG_SHARED_PTR, when I wrap the
> function above, SWIG generates me a SWIGTYPE_p_CategoryPtr type.
> I have also tried using a typedef before the SWIG_SHARED_PTR
> declaration without success.
> 
> My target language is C#.
> 

Not sure what you are doing wrong. Here is a simple example that works fine:

%module example

%include <boost_shared_ptr.i>

SWIG_SHARED_PTR(Category, Category)

%inline %{
#include <boost/shared_ptr.hpp>
struct Category {};
typedef boost::shared_ptr<Category> CategoryPtr;
CategoryPtr getCategory (int i) { return CategoryPtr(new Category()); }
%}

William

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

Gmane