From: Mark W. <ma...@ne...> - 2006-08-16 13:14:10
|
Hello, With regard to my new Wx::TreeListCtrl module I have not figured out how to export the required constants. I have created the file cpp/tl_constants.cpp I have added the necessary include line in TreeListCtrl.xs #include "cpp/tl_constants.cpp" I have specified the constants on my use line in the sample: use Wx::TreeListCtrl qw( wxTR_VRULE wxTR_SHOW_ROOT_LABEL_ONLY ); I also tried: use Wx qw( wxTR_VRULE wxTR_SHOW_ROOT_LABEL_ONLY ); But I get an error that they are not exported?. "wxTR_VRULE" is not exported by the Wx::TreeListCtrl module What other magic do I need to perform to get these constants to work? Many thanks Mark PS. Original package uploaded had the #include line commented out and I had an eror in tl_constans.cpp (I changed an f1 to fl) but once complete the results were the same - no constants. |
From: Mattia B. <mat...@li...> - 2006-08-16 18:42:43
|
On Wed, 16 Aug 2006 15:10:33 +0200 "Mark Wardell" <ma...@ne...> wrote: Hi, > What other magic do I need to perform to get these constants to work? perldoc Exporter, at the very least :-) HTH Mattia |
From: Mark W. <ma...@ne...> - 2006-08-16 18:52:05
|
Hi, I understand Exporter and EXPORT and EXPORT_OK but I cannot see how these are used in the other wxPerl modules. Mark -----Original Message----- From: wxp...@li... [mailto:wxp...@li...] On Behalf Of Mattia Barbon Sent: 16 August 2006 08:43 PM To: wxp...@li... Subject: Re: [wxperl-users] Unable to export constants in Wx::TreeListCtrl On Wed, 16 Aug 2006 15:10:33 +0200 "Mark Wardell" <ma...@ne...> wrote: Hi, > What other magic do I need to perform to get these constants to work? perldoc Exporter, at the very least :-) HTH Mattia ------------------------------------------------------------------------- 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 _______________________________________________ wxperl-users mailing list wxp...@li... https://lists.sourceforge.net/lists/listinfo/wxperl-users |
From: Mattia B. <mat...@li...> - 2006-08-16 19:15:37
|
On Wed, 16 Aug 2006 20:51:53 +0200 "Mark Wardell" <ma...@ne...> wrote: Hello, > I understand Exporter and EXPORT and EXPORT_OK but I cannot see how these > are used in the other wxPerl modules. There is no magic: you inherit from Exporter and set up @EXPORT_OK (and %EXPORT_TAGS, if you need). In wxPerl the inheritance is in Wx.pm and the EXPORT_XXX setup in Wx::Wx_Exp (which is autogenerated, but this does not change anything). Then there is xx_constants.cpp, which defines a function for mapping names into constants and a wxPlConstants object to register it with the main wxPerl AUTOLOAD sub, but the error you see is caused by incorrect use of Exporter: in the package you do not populate EXPORT_OK and do not inherit from Exporter. Oh, and please do not use Wx::Mini: it is an implementation detail. Regards Mattia |
From: Mark W. <ma...@ne...> - 2006-08-17 07:57:30
|
Hi, Sorry to be a pain about this but I want to get it right. I am using the following in my Wx::TreeListCtrl.pm: use Exporter; use base qw( Exporter); use vars qw( $VERSION @EXPORT_OK ); @EXPORT_OK = qw( wxTR_VRULE wxTR_SHOW_ROOT_LABEL_ONLY ); But when I try and use these in my script sample1.pl I get the following error: Undefined subroutine &Wx::TreeListCtrl::wxTR_VRULE called ... So if I create the functions as below, where I get the values from the treelistctrl.h file. sub wxTR_VRULE { 0x8000 } sub wxTR_SHOW_ROOT_LABEL_ONLY { 0x0002 } Is this the way to do this? Or is there a easier/better way where I can automatically export these constants. I do not know if I can use the tl_constants.cpp method or what else I need to do ? I have removed Wx::Mini. The reason I first used it was because I was getting errors with wx_boot, but now the problems have gone, even when I remove the 'use Wx::Mini'. How can I increment $VERSION? The moment I change it to 0.02 in my TreeListCtrl.pm file I get an error on Wx::wx_boot as below. I tried to re-compile the XS files but still the error??? Wx::TreeListCtrl object version 0.01 does not match bootstrap parameter 0.02 at C:/Perl/lib/XSLoader.pm line 92. Thanks Mark -----Original Message----- From: Mattia Barbon [mailto:mat...@li...] Sent: 16 August 2006 09:16 PM To: Mark Wardell Cc: wxp...@li... Subject: Re: [wxperl-users] Unable to export constants in Wx::TreeListCtrl On Wed, 16 Aug 2006 20:51:53 +0200 "Mark Wardell" <ma...@ne...> wrote: Hello, > I understand Exporter and EXPORT and EXPORT_OK but I cannot see how > these are used in the other wxPerl modules. There is no magic: you inherit from Exporter and set up @EXPORT_OK (and %EXPORT_TAGS, if you need). In wxPerl the inheritance is in Wx.pm and the EXPORT_XXX setup in Wx::Wx_Exp (which is autogenerated, but this does not change anything). Then there is xx_constants.cpp, which defines a function for mapping names into constants and a wxPlConstants object to register it with the main wxPerl AUTOLOAD sub, but the error you see is caused by incorrect use of Exporter: in the package you do not populate EXPORT_OK and do not inherit from Exporter. Oh, and please do not use Wx::Mini: it is an implementation detail. Regards Mattia |