Bob Marinier | 2 May 15:26 2006
Picon

_CRT_SECURE_NO_DEPRECATE macro redefinition

In the SWIG-generated code, the following block is created:

/* Deal with Microsoft's attempt at deprecating C standard runtime 
functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
# define _CRT_SECURE_NO_DEPRECATE
#endif

The "problem" is that the headers I'm wrapping already define 
_CRT_SECURE_NO_DEPRECATE, so this generates a warning:

warning C4005: '_CRT_SECURE_NO_DEPRECATE' : macro redefinition

Can this be changed to check if _CRT_SECURE_NO_DEPRECATE is already 
defined, e.g.

/* Deal with Microsoft's attempt at deprecating C standard runtime 
functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && 
!defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif

Thanks,
Bob

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
(Continue reading)

Surendra Singhi | 2 May 19:14 2006
Picon

Re: [ab] SWIG -external-all questions

Hello all,
Luke J Crook <luke@...> wrote:

>I just downloaded and compiled the latest SWIG from CVS and I have a 
>question regarding the new functionality that you added this month. 
>
>* -extern-all ; This does not seem to work. No symbols are exported. 

I need to remove this option from being shown. It is not present and there
is no plan to add it, because it is unnecessary.
>
>* -lispify? What -cffi option do I use to test this? 
>
OK. I will give some examples and show how to use the new features. Also,
I will suggest reading the section
11.3 Features and the %feature directive in the SWIG docs.
SWIG/Doc/Manual/Customization.html

Say, file: test.i

%module test

%feature("inline") sleep; //this will inline the sleep function

%feature("export");     //start exporting symbols   
%feature("intern_function"); //start lispifying symbols
%include "test.cpp"     
%feature("intern_function",""); //start lispifying symbols

%feature("intern_function","lispify"); //start lispifying symbols
(Continue reading)

Surendra Singhi | 2 May 19:24 2006
Face
Picon

Re: [ab] SWIG -external-all questions

EFuzzyONE <at> netscape.net (Surendra Singhi) writes:

>>SWIG requests:
>>I'm not sure if you added any of these, but it would be great if you could: 
>>
>>1) Instead of substituting :pointer for enums, replace with the enum name, 
>>or :int for anonymous enums, for example:
>>>>>
>>enum Boolean { true = 0, false = 1 };
>>Boolean returnBoolean(int value); 
>>
>>Should generate:
>>(defcfun ("returnBoolean" returnBoolean) boolean
>> (value :int))
>><<< 
>>
>>2) For enums, SWIG should treat 'enum Boolean' as Boolean. For example:
>>>>>
>>enum Boolean returnBoolean(int value); 
>>
>>Should generate:
>>(defcfun ("returnBoolean" returnBoolean) boolean
>> (value :int))
>><<<< 
>>

The above two can be easily done, by defining your own type converters:

%typemap(cout) Boolean "boolean";
%typemap(cout) enum Boolean "boolean";
(Continue reading)

William S Fulton | 2 May 22:58 2006
Picon

Re: _CRT_SECURE_NO_DEPRECATE macro redefinition

Bob Marinier wrote:
> In the SWIG-generated code, the following block is created:
> 
> /* Deal with Microsoft's attempt at deprecating C standard runtime 
> functions */
> #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
> # define _CRT_SECURE_NO_DEPRECATE
> #endif
> 
> The "problem" is that the headers I'm wrapping already define 
> _CRT_SECURE_NO_DEPRECATE, so this generates a warning:
> 
> warning C4005: '_CRT_SECURE_NO_DEPRECATE' : macro redefinition
> 
> Can this be changed to check if _CRT_SECURE_NO_DEPRECATE is already 
> defined, e.g.
> 
> /* Deal with Microsoft's attempt at deprecating C standard runtime 
> functions */
> #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && 
> !defined(_CRT_SECURE_NO_DEPRECATE)
> # define _CRT_SECURE_NO_DEPRECATE
> #endif
>

I've committed this patch. Until you use the new version you can run 
'swig -DSWIG_NO_CRT_SECURE_NO_DEPRECATE' to solve the problem.

William

(Continue reading)

Olly Betts | 3 May 01:27 2006

PHP5 OO Wrapping

Currently SWIG's PHP support can wrap C++ to produce either a flat function
interface (so Class::method_name -> Class_method_name) or to produce an
OO interface, but the OO interface only works for PHP4.

Kevin suggested the best way to fix this was to get SWIG to output PHP
code to wrap the existing flat function interface (the PHP4 OO interface
is implemented using C).

I've been working on fixing this, and I now have a patch for SWIG which
is good enough to generate wrappers for Xapian.  It still needs a bit
of work - for example Xapian doesn't need getters or setters so I've
not done those yet.  I've also not updated the documentation yet.

Here's the latest patch - it's not ready to be applied yet, but I'd
welcome any comments, especially on things I'm doing the wrong way:

http://www.oligarchy.co.uk/xapian/patches/swig-php-gen-oo-wrappers9.patch

And here's an example of the PHP wrapper generated:

http://www.oligarchy.co.uk/xapian/patches/xapian9.phps

In the process of working on this, I've fixed a few problems in SWIG's
PHP backend, which really should be submitted as separate patches first.
I'd like to start pulling those out and getting them applied.

However, SourceForge's anoncvs mirroring has been offline for ages (this
applies to all projects using SourceForge's CVS I believe).  I don't
know exactly when it failed, but the latest update to SWIG's anoncvs
tree seems to have happened just after the 1.3.29 release (2006-03-21).
(Continue reading)

Kevin Ruland | 3 May 03:55 2006

Re: PHP5 OO Wrapping


Olly,

Wow!  That's great.  Glad to hear this is proving to be so good.  I 
certainly welcome any help with the php generator -- especially since 
I've been laying low in a new job for over 2 months now.

Towards that end, I do have the UTL patches lying about, but they need 
to be merged back to head and committed.  Then I'm not very certain 
exactly what will break.

I'll try to merge your patches in first, then get the UTL patches in 
there.  Then hopefully there will be enough time to shake it out before 
the next release.

Kevin.

Olly Betts wrote:
> Currently SWIG's PHP support can wrap C++ to produce either a flat function
> interface (so Class::method_name -> Class_method_name) or to produce an
> OO interface, but the OO interface only works for PHP4.
>
> Kevin suggested the best way to fix this was to get SWIG to output PHP
> code to wrap the existing flat function interface (the PHP4 OO interface
> is implemented using C).
>
> I've been working on fixing this, and I now have a patch for SWIG which
> is good enough to generate wrappers for Xapian.  It still needs a bit
> of work - for example Xapian doesn't need getters or setters so I've
> not done those yet.  I've also not updated the documentation yet.
(Continue reading)

Surendra Singhi | 3 May 13:04 2006
Face
Picon

Re: [ab] SWIG, additional functionality requested for structs

Hello,

Luke J Crook <luke@...> writes:

> A CFFI feature request whereby a struct is replaced with :pointer only if 
> that slot is actually a pointer to a struct. For example: 
>
> struct _a_struct { int x; int y; } a_struct;
> typedef struct _a_struct *b_struct; 
>
> struct _b_struct { a_struct struct_1; b_struct struct_2; } b_struct; 
>
> Should be: 
>
> (defcstruct b_struct
> 	(struct_1 a_struct)
> 	(struct_2 :pointer)) 
>

This functionality has been added for structs/unions/enums by a recent patch
to the cvs repo.

Also, declaring %typemap(cin) Boolean "boolean", explained in a different
email is also not required.

Cheers.
--

-- 
Surendra Singhi
http://ssinghi.kreeti.com, http://www.kreeti.com
Read my blog at: http://cuttingtheredtape.blogspot.com/
(Continue reading)

Picon

Automatically disowning objects?

Hi,

How do I go about automatically disowning newly created objects? So far 
I've tried a couple of alternatives::

	%feature("self:disown") Object::Object;
	%delobject Object::Object;

But none of them work. What's the easiest way to insert this without 
having to manually process SWIG's output shadow classes? (I'm working 
in Python)

Regards,
-- Mikael

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Olly Betts | 3 May 18:55 2006

Re: PHP5 OO Wrapping

On 2006-05-03, Kevin Ruland <kruland <at> sunflower.com> wrote:
> Wow!  That's great.  Glad to hear this is proving to be so good.  I 
> certainly welcome any help with the php generator -- especially since 
> I've been laying low in a new job for over 2 months now.

I've also implemented setters and getters for member variables now
(though they're barely tested currently).  I've not done static
member variables or global variables yet, but I can use the same
approach I think.

> Towards that end, I do have the UTL patches lying about, but they need 
> to be merged back to head and committed.  Then I'm not very certain 
> exactly what will break.

Overload resolution is pretty broken already, though you can fix it
up with a few custom typemaps at least.

> I'll try to merge your patches in first, then get the UTL patches in 
> there.  Then hopefully there will be enough time to shake it out before 
> the next release.

OK, shall we start with unrelated (and tangentially related) patches?

I believe I sent a patch which cleans up legacy code to handle "string
pointers" in PHP4 (which can't ever be used because the corresponding
code to create them is no longer there!)  Has that been applied?

Cheers,
    Olly

(Continue reading)

Jason Stewart | 4 May 11:13 2006
Picon

Re: [Swig-user] returning empty string from perl

Hey Marcelo,
>
> On 5/4/06, Marcelo Matus <mmatus <at> acms.arizona.edu> wrote:
> > Try the CVS version now please.
> >

Do we have a test for this?

Cheers, jas.

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642

Gmane