|
From: Marcelo M. <mm...@ac...> - 2006-03-29 03:22:53
|
Does this work?
------
%module wpcieapi
extern int CopyCacheFileToFolder(char* strUrl, char*
strTargetFolderName, char* strTitle, int* TitleLength);
%include cpointer.i
%pointer_functions(int, intp);
----
if not, could you print the first argument of CopyCacheFileToFolder
before is called?
thanks
Marcelo
majinke wrote:
> Hi,
> When i swig compile .c file, all is ok. but when run it, it raise the
> following error:
> TypeError in method 'CopyCacheFileToFolder', augument 1 of type 'char *=
'
> 1.3.27 is OK, but 1.3.28 and 1.3.29 is raise error, can anyone help
> me, thanks.
> .c
> BOOL CopyCacheFileToFolder(char* strUrl, char* strTargetFolderName,
> char* strTitle, int* TitleLength)
> {
> }
> .i
> %module wpcieapi
> %inline %{
> extern int CopyCacheFileToFolder(char* strUrl, char*
> strTargetFolderName, char* strTitle, int* TitleLength);
> %}
> extern int CopyCacheFileToFolder(char* strUrl, char*
> strTargetFolderName, char* strTitle, int* TitleLength);
> %include cpointer.i
> %pointer_functions(int, intp);
> .pl
> sub copy_cachefile_to_folder
> {
> my ($str, $base_uri, $orig_text, $folder, $repl_html_folder) =3D @_;
> my $url_string =3D uri_unescape(URI->new_abs($str, $base_uri));
> $url_string =3D~ s/\/\.+\//\//;
> my $title =3D ' ' x 256;
> my $title_len =3D wpcieapi::new_intp();
> my $ret_val =3D wpcieapi::CopyCacheFileToFolder($url_string, $folder,
> $title, $title_len);
> my $len =3D wpcieapi::intp_value($title_len);
> my $shor_title =3D substr($title, 0, $len);
> wpcieapi::delete_intp($title_len);
> if ($ret_val =3D=3D 1){
> my $replace_str =3D $repl_html_folder . $shor_title;
>
> #<img src=3D"images/itbook/logo/logo_c++.gif" width=3D"180" height=3D"6=
0"
> border=3D"0">
> $str =3D~ s/\+/\\+/gi;
>
> $orig_text =3D~ s/$str/$replace_str/i;
> }
> my ($file, $dir, $ext) =3D fileparse($shor_title, qr/\.[^.]*/);
> return ($orig_text, $file, $ext);
> }
> Regards,
> Jack
>
> -----------------------------------------------------------------------=
-
> =D1=C5=BB=A21G=C3=E2=B7=D1=D3=CA=CF=E4=B0=D9=B7=D6=B0=D9=B7=C0=C0=AC=BB=
=F8=D0=C5 <http://cn.mail.yahoo.com>
> =D1=C5=BB=A2=D6=FA=CA=D6-=CB=D1=CB=F7=A1=A2=C9=B1=B6=BE=A1=A2=B7=C0=C9=A7=
=C8=C5 <http://cn.zs.yahoo.com>=20
|