Sponsored Content
Top Forums Programming How to access a C function from a shell script? Post 302979142 by Don Cragun on Wednesday 10th of August 2016 01:47:36 AM
Old 08-10-2016
I fail to see how this thread is fundamentally different from the 1st question in your first thread: How to extract operand size in bits of a C program? nor why you believe that changing from an addition to a multiplication should cause a different answer than what you received in post #2 in that thread??? Is there some reason why you believe the answer I provided there is wrong?

I suppose if you really wanted to you could try to write a C language parser in a shell script to look for every multiplication operation in the C and assembler source files it is asked to process and instead of producing object code emits sizes of the types of the variables or constants being multiplied. And, if what you really want is the highest bit set in the results of each of those multiplications (as in the second question in your first thread), you would not only have to produce runnable object code, but also run them with real data and have your compiler add code to that object code that would print he highest bit set after each multiplication operation found in the source files you processed with your compiler.

I won't say it is impossible to do this, but shell is certainly not the language of choice for a project like this.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

getting the value of a c function in shell script

Let say there is a module fileselection module written in c language which returns the file name. Is it possible to get the file name from the file selection module directly, I mean can we call a c function directly in shell script without doing executable. If possible then how it can be... (1 Reply)
Discussion started by: surjyap
1 Replies

2. Shell Programming and Scripting

Shell Script Function

Dear Friends, I am on SOLARIS 9 (ksh) I am working on a shell script that upload files with NcFTP with resume option. So far the script is working correctly. The script makes a list of files that need to be transferred and then launch the NcFTP command to start the transfer. ... (0 Replies)
Discussion started by: Aswex
0 Replies

3. Shell Programming and Scripting

SHELL SCRIPT Function Calling Another Function Please Help...

This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord but only one record is getting wrote in DB.... Please advise ASAP...:confused: function InsertFtg { FTGSTR="" echo "Saurabh is GREAT $#" let... (2 Replies)
Discussion started by: omkar.sonawane
2 Replies

4. Shell Programming and Scripting

access db2 from shell script

How to connect to db2 through shell script using cygwin? (0 Replies)
Discussion started by: supriyat
0 Replies

5. Red Hat

how to call a particular function from one shell another shell script

please help me in this script shell script :1 *********** >cat file1.sh #!/bin/bash echo "this is first file" function var() { a=10 b=11 } function var_1() { c=12 d=13 (2 Replies)
Discussion started by: ponmuthu
2 Replies

6. Shell Programming and Scripting

Call a function in shell script from another shell script

I've 2 shell scripts viz., CmnFuncs.ksh and myScript.ksh. 1st script contains all common functions and its code is as below: $vi CmnFuncs.ksh #!/bin/ksh RunDate() { .... .... export Rundt=`date +%Y%m%d` } 2nd script is invoking the above one and I expect to use the RunDt variable... (8 Replies)
Discussion started by: njny
8 Replies

7. Shell Programming and Scripting

Shell Script function to use script name for log file output

Hi Team - I"m very new to Shell Scripting so I have a rather novice question. My forte is Windows Batch Scripting so I was just wondering what the Shell Script equivalent is to the DOS command %~n? %~n is a DOS variable that dispayed the script name. For instance (in DOS): REM... (11 Replies)
Discussion started by: SIMMS7400
11 Replies

8. Shell Programming and Scripting

What is the function of the following lines at the top of a shell script file: Directory and Script?

The file starts like this: Directory: <path to the script> Script: <script fife name> #!bin/ksh ##Comments <actual script> What is the use of the first two lines in the script? What if I save the file without them? What will be the effect? They are not comments. Im very new to this,... (4 Replies)
Discussion started by: remytom
4 Replies

9. Shell Programming and Scripting

Except script to run a local shell script on remote server using root access

local script: cat > first.sh cd /tmp echo $PWD echo `whoami` cd /tmp/123 tar -cvf 789.tar 456 sleep 10 except script: cat > first #!/usr/bin/expect set ip 10.5.15.20 set user "xyz123" set password "123456" set script first.sh spawn sh -c "ssh $user@$ip bash < $script" (1 Reply)
Discussion started by: Aditya Avanth
1 Replies

10. Shell Programming and Scripting

Shell script to pass the config file lines as variable on the respective called function on a script

I want to make a config file which contain all the paths. i want to read the config file line by line and pass as an argument on my below function. Replace all the path with reading config path line by line and pass in respective functions. how can i achieve that? Kindly guide. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies
pthread_setname_np(3)					     Library Functions Manual					     pthread_setname_np(3)

NAME
pthread_setname_np - Changes the object name in the thread object for an existing thread. LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so) SYNOPSIS
#include <pthread.h> int pthread_setname_np( pthread_thread_t thread, const char *name, void *mbz); PARAMETERS
Thread object whose object name is to be changed. Object name value to copy into the thread object. Reserved for future use. The value must be zero (0). DESCRIPTION
This routine changes the object name in the thread object specified by thread to the value specified by name. To set an existing thread's object name, call this routine after creating the thread. However, with this approach your program must account for the possibility that the target thread has already exited or has been canceled before this routine is called. The object name is a C language string and provides an identifier that is meaningful to a person debugging a DECthreads-based multithreaded application. The maximum number of characters in the object name is 31. This routine contrasts with pthread_attr_setname_np, which changes the object name attribute in a thread attributes object that is used to create a new thread. RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows: Successful completion. The thread specified by thread does not exist. The length in characters of name exceeds 31. Insufficient memory exists to create a copy of the object name string. ERRORS
None RELATED INFORMATION
Functions: pthread_getname_np(3), pthread_attr_setname_np(3) Manuals: Guide to DECthreads and Programmer's Guide delim off pthread_setname_np(3)
All times are GMT -4. The time now is 07:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy