William S Fulton | 1 Aug 2007 02:08
Picon
Favicon
Gravatar

Re: SWIG Bug -- Smart Pointer and Templated Method returning Smart Pointer

craigdo <at> ee.washington.edu wrote:
> I have a problem with a SWIG binding that combines smart pointers and a
> method returning a templated smart pointer.  It appears to be a SWIG bug,
> but I could be misunderestimating what I need to do with respect to the
> wrapping strategery.
>  
> SWIG seems to correctly figure out that a smart pointer is involved on the
> calling side and do the required (*arg)->method for the non-template methods
> in my class Object, but seems to forget that a smart pointer is involved in
> the templated method and just does the arg->method call.
>  
> Here's an excerpt from a simplified .i file that demonstrates the problem:
>
> ---------- begin included text ----------
>  
> namespace ns {
>  
> template <typename T>
> class Ptr
> {
> public:
>   Ptr ();
>   T *operator -> ();
> };
>  
> class InterfaceId
> {
>   InterfaceId (uint16_t iid);
> };
>  
(Continue reading)

William S Fulton | 1 Aug 2007 02:10
Picon
Favicon
Gravatar

Re: Director compile errors

Stephen Pietrowicz wrote:
> Hi,
>
> I'm trying to get directors to work properly, and have run into a  
> problem.    I put the director directives into my .i file.
>
> I invoked SWIG with "-features director" on the command line, and it  
> SWIGed to completion.
>
> When I tried to compile the resulting file, I received the message:
>
> python/lsst/mwi/events_wrap.cc: In function 'PyObject*  
> _wrap_PySwigIterator_value(PyObject*, PyObject*)':
> python/lsst/mwi/events_wrap.cc:4351: error: 'Swig' has not been declared
> python/lsst/mwi/events_wrap.cc:4351: error: 'Director' was not  
> declared in this scope
> python/lsst/mwi/events_wrap.cc:4351: error: 'director' was not  
> declared in this scope
> python/lsst/mwi/events_wrap.cc:4360: error: 'SWIG_DIRECTOR_CAST' was  
> not declared in this scope
> python/lsst/mwi/events_wrap.cc:4374: error: 'Swig' has not been declared
>
>
> along with many other compile errors.
>
> What do I have to do to get my swigged code to compile?  Any ideas?
>
> I'm using Swig 1.3.31, Python 2.5, and gcc 4.0.1
>
>   
(Continue reading)

mark gossage | 1 Aug 2007 03:08

Re: Easiest way to pass arrays into SWIG

Hello There,

Disclaimer: I have not touched Perl in a long time, so I won't be able to give perl examples, but the problem is
a common SWIG issues & I will tackle it that way.

The easiest way to deal with arrays and such is to have a bunch of helpers to create and fill the arrays, then
pass them into the C. This is very easy from the perspective of writing the wrappers, though its tedious to use.

eg.

int some_fn1(int arr[],int arrlen)

The simplest way to deal with this kind of function is
%include "carray.i"  //standard swig library

%array_functions(int,intarr) // declares a few useful functions
// int *new_intarr(int nelements)
// void delete_intarr(int *);
// int intarr_getitem(int *, int index);
// void intarr_setitem(int *, int index, int value);

then your code becomes (in a pseudo basic)

A=new_intarr(100)
for I=0..99
  intarr_setitem(A,I,somevalue)
next
B=some_fn1(A,100)
delete_intarr(A)

(Continue reading)

mark gossage | 1 Aug 2007 03:14

Re: VS.Net 2005 Custom Build Step

Hello Herbie,
The mailer munched you attachment, but here are some idea's.

You say that there is no output, thats a serious problem. SWIG normally provides a  file with some code in it,
so it looks like you might have the command args wrong.
Add an 'echo on' to your custom build step, this should allow the error message to be displayed.
You seem to be missing a target language in your swig call (-python or -java or whatever).
Try running your code from the command line and see if it works.
This custom build rule should be added to the .i file which is in your project. If you need to just 'build' this
file by right clicking on it an selecting 'compile'

Hope this helps,
Mark Gossage

> That cleared things up thanks, but now I'm having an issue in that swig is
> not generating any files.  Wondering what I'm doing wrong.
> 
> Here's what my setting look like now. Along with my interface.
> 
> 
> Command Line: echo on "C:\Documents and
> Settings\herbieh\Desktop\Clean\swigwin-1.3.31\swig" -c++ -o
> $(InputName)_wrap.cpp $(InputPath)
> 
> Description: Performing Custom Build Step
> 
> Outputs: $(InputName)_wrap.cpp
> 
> Thanks for any help you can provide
> 
(Continue reading)

Michele Joyce | 1 Aug 2007 15:22
Favicon

Re: namspace

Try this in the interface file:

% {
using namespace semnet;
%}

This will include the line in the swig generated file.

Michele

anton feldmann wrote:
HI, I wrote a interface file. In this interface File I included headerfiles but the namespaces of 3 classes are not included to. for example: ../../src/tclBind.cc:2130: error: ‘eventFilter’ was not declared in this scope It should be semnet::eventFilter. I tried to write the line %using semnet::eventFilter; in the interface file. but does not work. cheers anton ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ 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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
Herbie | 1 Aug 2007 18:20
Picon
Favicon

Unable to find header files

Thanks for your help, I've actually got it looking through the
interface...finally, but now its having trouble finding the %includes.
Here's what one of mine looks like in the interface and a couple other forms
I've tried:

%include "401a\401a.h" 
%include "\401a\401a.h"
%include ".\401a\401a.h"  

I am trying to wrap around an API, the headers have been broken down into
several folders and cannot be combined as there are naming conflicts.  I
can't seem to get swig to recognize the subfolders.

Any ideas would be great.

Thanks again,

Herbie

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
anton feldmann | 1 Aug 2007 19:32
Picon
Picon

load lib into tclsh

Hi,

i have the following problem:
I have make a project out of a lot of different projects. I used Swig to 
write a scripting interface for tcl first. I can compile the generated 
C++ file but i can not load the  .so file to tclsh:

couldn't load file "./tclBind.so": libpt_linux_x86_r.so.1.11.0: cannot 
open shared object file: No such file or directory

made the .so file with the commando:

g++ tclBind.o -o tclBind.so -L/homes/afeldman/develop/lib/i386 
-L/vol/wbsnew/lib/i386 -L/vol/opt/i386//lib -L/vol/wbsnew/lib/i386 
-L/homes/afeldman/develop/lib/i386 -L/vol/lua/lib/ 
-L/vol/boost/ubuntu-current/lib -L/usr//lib -L/usr/lib/ 
-L/vol/boost/ubuntu-current//lib  -L/vol/gc-lib/lib  -shared -ldl 
-ltcl8.4 -lscvBasicClasses  -lutilGraph -llualib -llua -lluabind   -lgc

does someone have an answer?

cheers

anton

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
leonid glimcher | 1 Aug 2007 20:08
Picon

Re: load lib into tclsh

Anton,

is the machine you're running SWIG on a 64-bit architecture machine? 
I've had a similar problem loading a c++ shared object into Java, and 
the reason was that i was building a 64 bit shared object and trying to 
load it using a 64-bit JVM. I'm not sure how tcl works, but could your 
problem be related to that?

~leo

anton feldmann wrote:
> Hi,
> 
> i have the following problem:
> I have make a project out of a lot of different projects. I used Swig to 
> write a scripting interface for tcl first. I can compile the generated 
> C++ file but i can not load the  .so file to tclsh:
> 
> couldn't load file "./tclBind.so": libpt_linux_x86_r.so.1.11.0: cannot 
> open shared object file: No such file or directory
> 
> made the .so file with the commando:
> 
> g++ tclBind.o -o tclBind.so -L/homes/afeldman/develop/lib/i386 
> -L/vol/wbsnew/lib/i386 -L/vol/opt/i386//lib -L/vol/wbsnew/lib/i386 
> -L/homes/afeldman/develop/lib/i386 -L/vol/lua/lib/ 
> -L/vol/boost/ubuntu-current/lib -L/usr//lib -L/usr/lib/ 
> -L/vol/boost/ubuntu-current//lib  -L/vol/gc-lib/lib  -shared -ldl 
> -ltcl8.4 -lscvBasicClasses  -lutilGraph -llualib -llua -lluabind   -lgc
> 
> does someone have an answer?
> 
> cheers
> 
> anton
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> 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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
Michele Joyce | 1 Aug 2007 20:10
Favicon

Re: load lib into tclsh

This usually means that you forgot (or missed) to link a library that 
you need. Make sure that all of the library paths are right.
What's the command you're trying to use to load the library into your 
tcl script?
Michele

anton feldmann wrote:

>Hi,
>
>i have the following problem:
>I have make a project out of a lot of different projects. I used Swig to 
>write a scripting interface for tcl first. I can compile the generated 
>C++ file but i can not load the  .so file to tclsh:
>
>couldn't load file "./tclBind.so": libpt_linux_x86_r.so.1.11.0: cannot 
>open shared object file: No such file or directory
>
>made the .so file with the commando:
>
>g++ tclBind.o -o tclBind.so -L/homes/afeldman/develop/lib/i386 
>-L/vol/wbsnew/lib/i386 -L/vol/opt/i386//lib -L/vol/wbsnew/lib/i386 
>-L/homes/afeldman/develop/lib/i386 -L/vol/lua/lib/ 
>-L/vol/boost/ubuntu-current/lib -L/usr//lib -L/usr/lib/ 
>-L/vol/boost/ubuntu-current//lib  -L/vol/gc-lib/lib  -shared -ldl 
>-ltcl8.4 -lscvBasicClasses  -lutilGraph -llualib -llua -lluabind   -lgc
>
>does someone have an answer?
>
>cheers
>
>anton
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc.
>Still grepping through log files to find problems?  Stop.
>Now Search log events and configuration files using AJAX and a browser.
>Download your FREE copy of Splunk now >>  http://get.splunk.com/
>_______________________________________________
>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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
Amos Shapira | 2 Aug 2007 05:32
Picon
Gravatar

Too many levels of nesting in generated perl module names

Hello,

As part of my learning to use SWIG, I created the following .i file from the "SWIG Basics" document in (http://www.swig.org/Doc1.1/HTML/SWIG.html ):

%module list
%{
#include "list.h"
%}

class List {
public:
  List();
  ~List();
  int   search(char *value);
  void  insert(char *);
  void  remove(char *);
  char  *get(int n);
  int   length;
  static void print(List *l);
};

I created a "noop" impelentation of this class and run SWIG successfully, but the generated interfaces puts the methods under package "list::List" instead of directly under "list".

What am I missing?

Thanks,

--Amos



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user

Gmane