Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Passing a very large string by reference to a c library

by dino (Sexton)
on Jul 16, 2001 at 15:22 UTC ( [id://96992]=note: print w/replies, xml ) Need Help??


in reply to Re: Passing a very large string by reference to a c library
in thread Passing a very large string by reference to a c library

This stems from my (mistaken) belief that perl copies variables on subroutine calls. It appears that this is not true ;-). It seems that the copying may take place during the standard assignment in the subroutine body which can be avoided with a little thought. eg:

&find_index($key, \$bigstring);

sub find_index {
  my ($key, $rbigstring) = @_;

becomes:
&find_index($key, $bigstring);

sub find_index {
  my ($key) = $_[0];
  my ($rbigstring) = \$_[1];
 

This has the added benefit of making the sub call for both c and perl the same.

Thanks for your help

dino

  • Comment on Re: Re: Passing a very large string by reference to a c library

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://96992]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-23 22:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found