ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-porters
perl-win32-porters
strange problem with newSVpvn
by Caminati Carlo other posts by this author
Apr 26 2007 6:39AM messages near this date
view in the new Beta List Site
RE: OLE Issue while Porting from Perl 5.6 to Perl 5.8 | Re: strange problem with newSVpvn
Hello

I have a really strange problem with perlembed

the following fragment of C uses a persistent interpreter
and lives in a DLL

the function TrapFwPFisToBeSent is called by a main program
a lot of times. I have the following cases:

- in a test environment (same DLL called my a small main) ->  all OK

- in production environment (same DLL called within a large framework
  including SNMP libraries, HP OpenView libraries and so on) -> 
  in a lot of cases the first newSVpvn raises an exception caught by the
	caller of this function.
	In some cases the calls are ok and I get the result of the Perl
routine.
	I'm not able to extract a rule to understand
  why it fails on some cases and not in some others. I also took a look
to the
  disassembly of perl58.dll but I'm only able to see that it crashesc 
	(Access violation, typical of accessing to protected memory).

- the problem is present also if the subroutine 'isToBeSent' is an empty
  container like following:

				sub isToBeSent {
					my ($node,$text) = @_;
					my $send = 1;
					return $send;
				}

   this confirms to me that the problem is in 'newSVpvn' (I tried also
	 newSVpv with the same result).


any ideas ?

TIA

Carlo

------------------------------------------------------------------------
-- 

int TrapFwPFisToBeSent(char *node,char *text)
{
	dSP ;
	int count, ret, l_node, l_text;
	
	ENTER ;
	SAVETMPS ;        
	PUSHMARK(SP) ;
	l_node = strlen(node);
	XPUSHs(sv_2mortal(newSVpvn(node,l_node)));	// prima era
newSVpv con 0 
	l_text = strlen(text);
	XPUSHs(sv_2mortal(newSVpvn(text,l_text)));
	PUTBACK ;        
	count = call_pv("isToBeSent", G_SCALAR);

	SPAGAIN;

	if (count != 1)
		croak("Big trouble\n");

	ret = POPi;

	PUTBACK;
	FREETMPS;
	LEAVE;

	return ret;
}

------------------------------------------------------------------------
--
My environment:

OS: Win XP SP2
compiler: MSVC++ 6.0 SP4

perl -v

This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 33 registered patches, see perl -V for more detail)

Copyright 1987-2006, Larry Wall

Binary build 819 [267479] provided by ActiveState
http://www.ActiveState.com
Built Aug 29 2006 12:42:41

.....
_______________________________________________
Perl-Win32-Porters mailing list
Perl-Win32-Porters@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Caminati Carlo
Frank Merrow
Jan Dubois

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved