How to call C functions in shell scripts?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to call C functions in shell scripts?
# 1  
Old 04-08-2008
How to call C functions in shell scripts?

How can i call dynamic C functions in shell scripts?
# 2  
Old 04-08-2008
The question does not seem entirely well-defined. The normal way to use C code is to compile it into an executable. If you compile it into a shared libary, and have another (reasonably, C) application which can load a shared library and run an arbitrary function from that library, there you have it; but if I understand your question correctly, there is no standard solution to this problem (and indeed there hardly could be, as you cannot pass in arguments as native C types from the shell easily -- the abstraction levels are quite different).
# 3  
Old 04-08-2008
Hi Era...

I meant to say was that there is a c program which contains some functions which are called during runtime. Now i am writing a shell script which uses these functions. So how can i call these functions in my shell script?

Thanks in advance.
# 4  
Old 04-08-2008
You make your program such that you can tell it from the command line which function to run.
# 5  
Old 04-08-2008
Another approach is to use ksh93 and load your functions from a shared libary into the shell via the builtin -f command. However there is a fairly steep learning curve with this approach.
# 6  
Old 04-09-2008
Hi,

Please check the link below whether this is waht u are looking for

https://www.unix.com/shell-programmin...ll-script.html

Thanks
Js
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Call functions from other scripts

i have a file that contains functions and i want the functions to be available in another script. of course, the ideal situation here would be to put the functions in the same script, but i dont own these scripts. so I have to call the functions file from a different script. how do i... (3 Replies)
Discussion started by: SkySmart
3 Replies

2. Shell Programming and Scripting

Help Modify call to functions depending on file name

Hi, I am creating a script that does gunzip/unzip/untar depending on the file extension. I have created 3 functions in my script and call them in following order. 1) gunzip function 2) unzip function 3) untar function I am using FILENAME=${FILENAME%.*} to modify filename between... (2 Replies)
Discussion started by: pinnacle
2 Replies

3. Programming

can a linux kernel module call libc functions?

can a linux kernel module call libc functions, such as printf(), strcpy(), etc...? (9 Replies)
Discussion started by: vistastar
9 Replies

4. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

5. UNIX for Advanced & Expert Users

Call parallel sql scripts from shell and return status when both sql are done

Hi Experts: I have a shell script that's kicked off by cron. Inside this shell script, I need to kick off two or more oracle sql scripts to process different groups of tables. And when both sql scripts are done, I will continue in the shell script to do other things like checking processing... (3 Replies)
Discussion started by: huasheng8
3 Replies

6. Shell Programming and Scripting

Scripts in ~/bin vs. functions in ~/.bashrc

Hi there, Anyone knows what would be the cons and pros of adding a script in ~/bin vs. a function in ~/.bashrc? I'm not sure how the system keeps tracks of some of the settings loaded in ~/.bashrc (like functions and aliases). Would I be right in thinking that this would all be loaded into... (2 Replies)
Discussion started by: victorbrca
2 Replies

7. Shell Programming and Scripting

Bash: Nested functions and including other scripts

Hello. I have the following problem with bash code: function fl1_load_modules_and_get_list() ........... for module in $FL_MODULES_TO_PROCESS do source "${FL_MODULE_DIR}/${module}/module.sh" done ........... } function fl1_handle_install { local... (12 Replies)
Discussion started by: FractalizeR
12 Replies

8. Shell Programming and Scripting

Calling functions in scripts directly

Hi, I have a menu driven script that does various tasks, I want to be able to call functions directly from within other unix scripts from my menu script. Is this possible? (12 Replies)
Discussion started by: LiquidChild
12 Replies

9. Programming

call functions from diferents programs

hi i have ten program in C, and there are functions what are in all the programs. so, i want to make a directory to store all the functions what are in all the programs, and call them from the C programs. (sending variables and values) is that possible?¿? how ca i do that?¿? any idea,... (1 Reply)
Discussion started by: DebianJ
1 Replies

10. Shell Programming and Scripting

Making a SOAP call from within unix shell scripts

Hi guys, Is it possible to make SOAP calls from within Unix shell scripts? I need to access a web service from within UNIX in order to lookup something while I am doing some parsing on a file. Regards, Laud (2 Replies)
Discussion started by: Laud12345
2 Replies
Login or Register to Ask a Question