perl.xs...Re: Problem on perl callbacks from XS by Cosimo- May 25, 2008 On 24 Mag, 23:54, cosimo.strepp...gmail.com (Cosimo) wrote:> Hi to perl.xs,>> I have posted this question also to perlmonks,> under http:www.perlmonks.orgnode_id=688332.I solved the problem.Perlmonks node was updated with info on how I did it.--Cosimohttp://www.nntp.perl.org/group/perl.xs/2008/05/msg2462.html Problem on perl callbacks from XS by Cosimo- May 25, 2008 Hi to perl.xs,I have posted this question also to perlmonks,under http:www.perlmonks.orgnode_id=688332.I&39;ve been fighting with this problem for a while, and despite my bestefforts, I&39;m still stuck. Maybe very near to the solution, but stillstuck. I believe that the following simple case is the root of theproblem. Feel free to correctdirect me. Relevant code follows:GV to_string = gv_fetchmethod (SvSTASH (sv), "toString");if (to_string) dSP; SV res_sv; result scalar ...http://www.nntp.perl.org/group/perl.xs/2008/05/msg2461.html sv_setsv and perl 5.10 by Marco d'Itri- May 11, 2008 After upgrading the system perl from 5.8 to 5.10 (Debianunstable), myold INN 1.x package started failing with "Bizarre copy of UNKNOWN"caused by this sv_setsv() call (the idea is save RAM between eachinvocation by deallocating the body SV when it&39;s not needed anymore).I worked around this by replacing the call with "body = &PL_sv_undef",but I do not know if this is more broken andor creates a memory leak.Please advise.The relevant code (nnrpdperl.c) is:char...http://www.nntp.perl.org/group/perl.xs/2008/05/msg2460.html RE: Best practice for updating a string by Erland Sommarskog- May 1, 2008 "Jan Dubois" (jandactivestate.com) writes:> In particular, you cannot update hash keys in-place at all: besides> them sharing memory in a shared hash key table, you would also end> up with a different hash for the new key, so you would be breaking> hash lookup. If you want to change the hash key, you need to remove> the entry using the old key and add it back using the new key. Yes, that is clear to me. And in this I need to create a entirely newhash, as the...http://www.nntp.perl.org/group/perl.xs/2008/05/msg2459.html RE: Best practice for updating a string by Jan Dubois- May 1, 2008 On Thu, 01 May 2008, Jan Dubois wrote:> On Thu, 01 May 2008, Erland Sommarskog wrote:> >> > I have in my XS module a routine that converts the charcaters of an SV> > from one code page to another. The conversion is done "in-place". That is,> > I retrieve the text pointer, and then I rewrite the area pointed to. For> > reference, the full code for the routine is included at the end of this> > post.> > In general, you should never change SVs..http://www.nntp.perl.org/group/perl.xs/2008/05/msg2458.html RE: Best practice for updating a string by Jan Dubois- May 1, 2008 On Thu, 01 May 2008, Erland Sommarskog wrote:> > I have in my XS module a routine that converts the charcaters of an SV> from one code page to another. The conversion is done "in-place". That is,> I retrieve the text pointer, and then I rewrite the area pointed to. For> reference, the full code for the routine is included at the end of this> post.In general, you should never change SVs that are marked as read-only. if (SvREADONLY(sv)) croak("Cannot...http://www.nntp.perl.org/group/perl.xs/2008/05/msg2457.html Best practice for updating a string by Erland Sommarskog- May 1, 2008 I have in my XS module a routine that converts the charcaters of an SVfrom one code page to another. The conversion is done "in-place". That is,I retrieve the text pointer, and then I rewrite the area pointed to. For reference, the full code for the routine is included at the end of thispost. The module is an API for communicating with MS SQL Server from Perl. One feature is that the caller can request that data sent tofrom the server should be converted between different code pages...http://www.nntp.perl.org/group/perl.xs/2008/05/msg2456.html |