PHP std_vector.i

View: New views
1 Messages — Rating Filter:   Alert me  

PHP std_vector.i

by Mark Klein-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm having an issue with std_vector.i that I'm starting to think may  
be a bug.

In the attached example, I get:

Fatal error: No matching function for overloaded  
'new_MetadataResource' in /private/tmp/test2/librets.php on line 56

In digging into this with gdb, I see that the copy constructor is  
being invoked with a _p_p_MetadataResource. However, the method is  
expecting a _p_MetadataResource:

$1 = {
   name = 0x17a72ec "_p_MetadataResource",
   str = 0x17a7300 "MetadataResource *",
   dcast = 0,
   cast = 0x17ac200,
   clientdata = 0x17ac8ec,
   owndata = 0
}

$10 = 0x17a72c0 "_p_p_MetadataResource"

If I hack std_vector.i to change the %extend  T& get(int i) to T get
(int) things work as expected. Further, elsewhere in that file, I see  
a %define that provides a specialization of std::vector with just  
that change. I'm wondering why that is necessary unless the first  
implementation is wrong.

I'm wondering if anyone is using std_vector.i (the standard template  
and not the specialized version) and if it is working correctly for you.

I've extracted the minimum from our code to duplicate this and have  
attached it.

linus:~/temp mklein$ swig -version

SWIG Version 1.3.35


Comments? Recommendations? Am I doing something wrong?


Regards,


M.





[test.php]

<?
include_once('librets.php');

$metadata = new Metadata();

$resources = $metadata->GetAllResources();

$r = $resources->get(0);

print "done\n";


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

librets.cpp (413 bytes) Download Attachment
librets.h (802 bytes) Download Attachment
librets.i (707 bytes) Download Attachment
Makefile (394 bytes) Download Attachment
LightInTheBox - Buy quality products at wholesale price