The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Question for calling oracle function from perl ili Shell Programming and Scripting 0 03-29-2008 09:51 PM
Calling a C-function froma shell script jisha Shell Programming and Scripting 3 01-28-2008 03:08 AM
calling one function from another shell script trichyselva UNIX for Dummies Questions & Answers 1 01-17-2008 12:28 AM
urgent calling function from a script jisha Shell Programming and Scripting 2 01-09-2008 02:40 PM
calling c++ function from script Lebamb High Level Programming 3 06-24-2003 09:53 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-06-2008
jisha jisha is offline
Registered User
  
 

Join Date: Jan 2008
Location: Bangalore,India
Posts: 144
Arrow Calling a C-function froma Perl script

Hi All,

How can we call a c function from a perl script?
Is it the same way as we do for shell script ?

Thanks in advance
JS
  #2 (permalink)  
Old 05-07-2008
jisha jisha is offline
Registered User
  
 

Join Date: Jan 2008
Location: Bangalore,India
Posts: 144
I tried tuning the method to call c function from shell script .. but in vain ..
can some one please help
Thanks
JS
  #3 (permalink)  
Old 05-07-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
Can you give us an example of what you want to do? It is unusual to attempt to call a C function from a script of any kind.
  #4 (permalink)  
Old 05-07-2008
jisha jisha is offline
Registered User
  
 

Join Date: Jan 2008
Location: Bangalore,India
Posts: 144
ya sure ..a very simple example

my sample.c file is given below:

# include <stdio.h>
void pline(void);
main(int argc,char *argv[])
{
int i,j;

printf("Wow Entered main\n");

i=strcmp(argv[0],"pline"); /*just to test*/
j=strcmp(argv[1],"pline"); /*just to test*/
printf("i=%d \n j=%d\n",i,j);

if(strcmp(argv[1],"pline") == 0)
{
pline();
printf("done\n");
}
}

void pline(void)
{
int i;
for(i=1;i<5;i++)
printf("Test \n");
printf("\n");
}

No call the function from a 1.pl file .. this is my requirement
i guess we need to get the executable of sample.c after compiling. this too is done and executable is generated.

Thanks
  #5 (permalink)  
Old 05-07-2008
jisha jisha is offline
Registered User
  
 

Join Date: Jan 2008
Location: Bangalore,India
Posts: 144
This is the link where i have posted a solution for the shell script

Calling a C-function froma shell script
  #6 (permalink)  
Old 05-07-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
I would describe that as 'running a compiled C programme' rather than 'calling a C function'. You can do that using the system command in perl.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0