Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: reading C data structure

by davido (Archbishop)
on Sep 18, 2012 at 00:12 UTC ( #994156=note: print w/ replies, xml ) Need Help??


in reply to reading C data structure

It's unfortunate: The real question most probably has a good answer. But it's impossible to know what that answer is given the ambiguity and terseness in how you chose to communicate that question to us. I wish we knew what it is that you actually are trying to do.


Dave


Comment on Re: reading C data structure
Re^2: reading C data structure
by asura (Initiate) on Sep 18, 2012 at 02:11 UTC

    My apologies for the ambiguity. I have a variable in a C function (it is a uuid). A perl script needs to use this variable for some operation. Is there a way for me to read this variable from the perl script. I am trying to avoid writing it to a file and reading from it (expensive). Thanks in advance...

      That really doesn't get us much further ahead. Do you want write code to call Perl from C (possible), or write code to call C from Perl (also possible), or call an existing C library function from Perl (possible too), or execute an existing Perl script from a C application passing a value through (possible) or execute an existing C application from a Perl script returning a value to the script (also possible), or something else?

      Maybe you should let us in on the secret of what you actually want to do?

      True laziness is hard work

        i am writing a code to call C from Perl. As I said I have one variable in a C code that I want to export. This variable needs to be used by a perl function.

      If you want to communicate between two running processes, that will be much harder than just writing/reading the values to a tempfile.

      However, there is Convert::Binary::C, which was made for just that situation, debugging a remote process and dumping C structures from within Perl. Maybe that helps you.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (12)
As of 2015-07-01 20:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (19 votes), past polls