Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Re: Re: dilemma

by Courage (Parson)
on Aug 09, 2003 at 14:37 UTC ( #282414=note: print w/replies, xml ) Need Help??

in reply to Re: Re: dilemma
in thread dilemma

As I understand this problem, dragonchild actually proposed a solution that actually solves your problem, but you somehow overlooked that.

Consider: you'll define functions in XS with some changed name (use some prefix for example), without PROTOTYPE keyword and then provide prototype in, and those wrapper functions will call proper XS function.
Why this will not work in your case?

I did same thing for Tcl perl module, where I solved another problem this way: it was too complicated for me to do logic in XS, so I decided to move it to Perl side.

I'm not knowledgable enough to say you how to do a PROTOTYPE in perl-5.6.x

Courage, the Cowardly Dog

Replies are listed 'Best First'.
Re: Re: Re: Re: dilemma
by liz (Monsignor) on Aug 09, 2003 at 16:56 UTC
    I have no doubt that is possible. To an extent, this is already done in (because different subroutines are "imported" depending on whether you are using a threaded or an unthreaded perl).

    But this doesn't solve the migration path problem! Code written with the 5.6.x version of won't work in 5.8.x without change. I'm trying to find a solution that will allow a smooth upgrade path, so that code does not have to be changed. I believe using a source filter when running in 5.6.x will solve this problem. I'm working on that this weekend. Hopefully there'll be an update again to the original node when it's uploaded to CPAN.


      For sure we were talking apples and oranges.

      Initially I thought that you can not use *XS* feature in perl-5.6.1 that was appeared in perl-5.8.0.

      Now I see that in perl-5.6.1 there is no way at all to prototype a subroutine that takes a reference to array or hash as its first argument. I checked sources and realized that.

      In this case may be source filters could be kind of solution as a hack. But source filter not necessarily installed everywhere.

      May be it's better to introduce three prototyped functions for each: share_a, share_s, share_h (for sharing array, scalar and hash respectively)?

      Also I did some RTFSing (f=fine here), and now understand a little bit more on situation. Following code is a maximum that I reached on this matter, it finds a prototype for a subroutine:

      use B; sub share(\[@%$]) {print qq/[@_]/} %stash = B::svref_2object(\%{"::"})->ARRAY; $c=B::svref_2object(\&share); #... or this $c=B::svref_2object(\&share); print 'prototype equals to '. $stash{share}->CV->PV,"\n";

      Courage, the Cowardly Dog

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://282414]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2018-06-24 11:44 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.