Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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.


Replies are listed 'Best First'.
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...

      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.

      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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994156]
[Corion]: A good morning to everybody!

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2017-08-17 07:03 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (282 votes). Check out past polls.