
abhinav_shaan
New User
Feb 11, 2007, 10:13 PM
Post #6 of 6
(1733 views)
|
Re: [ProBulletin] Need help in doing C / Perl interface
[In reply to]
|
Can't Post
|
|
Hi, thanx for the responses. i will make my requirement more clear using an example. Imagine my C/C++ file looks like this : //*************** FILE BEGINS************** int a; void setI() { a = 10; } int returnI() { return a; } void main() { setI(); // : Pseudo call to a perl file. This is what i need to know system("source test.pl"); } // : C file ends NOw, i dont know perl syntax much , but this i how i imagine test.pl woulod look like **************** test.pl file **************** use .... .... .... my $x $x = getI() // : This is the call to the C function. print($x); ..... ..... ****************** end *************************** I want to build the C code as an executable so that on running the main function , that value 'a' should be set , then the perl file should be sourced which calls the getI() function and prints the returned value. I have tried using the Inline option provided in Perl. It works for small programs like above , but it requires that i right the C code in the perl file itself. I want a way to avoid writing the C code in the perl file i just want some way that an interface to an existing code / data structure can be created. Thanks, Abhinav
|