Sponsored Content
Top Forums Programming Extern keyward on function in C Post 302970939 by Don Cragun on Wednesday 13th of April 2016 04:13:45 PM
Old 04-13-2016
You can define a function to be static which makes it available only to functions calling that function from the same file in which that static function is defined.

If a function is declared to be external in a header that is included in a file that defines one or more of those functions as static, I think the results are undefined, but I'd have to do some digging through the C Standard to be sure that a diagnostic wouldn't be required in this case.
 

10 More Discussions You Might Find Interesting

1. Programming

extern for functions

Hi, Please let me know if the extern keyword is necessary for using functions which is defined and declared in another file and and used in a different file where both these files are linked together. thanks (8 Replies)
Discussion started by: naan
8 Replies

2. Shell Programming and Scripting

Passing global variable to a function which is called by another function

Hi , I have three funcions f1, f2 and f3 . f1 calls f2 and f2 calls f3 . I have a global variable "period" which i want to pass to f3 . Can i pass the variable directly in the definition of f3 ? Pls help . sars (4 Replies)
Discussion started by: sars
4 Replies

3. Programming

Extern variable.

file1.c int a1; int main() { a1 = 2; printf("\na1 = %d\n", a1); next(); printf("\na1 = %d\n", a1); next1(); printf("\na1 = %d\n", a1); } file2.c #include <stdio.h> int b1 = 0; void next(void) (1 Reply)
Discussion started by: Tanvirk
1 Replies

4. Linux

Problem mounting extern hd (fedora 9)

Hi there, I'm having a bit of a strange problem which I would appreciate some help with. The Problem: I have two external hard drives, but I'm borrowing one off my parents to copy data too (one of mine, which is identical to theirs - WD MyBook 300g - is on its way out). Fedora 9 recognizes... (3 Replies)
Discussion started by: lasthidingplace
3 Replies

5. UNIX for Dummies Questions & Answers

fetchmail and forward to an extern address

Hi, I'm searching for an solution for the following problem. I want fetch some mails via pop3 from a@a.com with fetchmail. That works perfectly. Now any incoming mail should forwarded to b@b.com via smtp obv. But I don't know how to configure that. All online tutorials describe forwarding to... (0 Replies)
Discussion started by: mcW
0 Replies

6. Shell Programming and Scripting

Return a value from called function to the calling function

I have two scripts. script1.sh looks -------------------------------- #!/bin/bash display() { echo "Welcome to Unix" } display ----------------------------- Script2.sh #!/bin/bash sh script1.sh //simply calling script1.sh ------------------------------ (1 Reply)
Discussion started by: mvictorvijayan
1 Replies

7. Programming

segmentation fault for extern

Why this is happening when both of them compiled together and run? I am getting segmentation fault SIGSEGV. File1.c: int arr; File2.c: extern int *arr; int main() { arr = 100; } (3 Replies)
Discussion started by: royalibrahim
3 Replies

8. Programming

C header file and extern

In the header file data.h i got: const char ack_msg = "ack: received your msg\n"; In the code file server.c i got: extern const char ack_msg; And else it is only used in a function call: user$ grep ack_msg *c *h server.c:extern const char ack_msg; server.c: n = write(clientsfd,... (5 Replies)
Discussion started by: tornow
5 Replies

9. Shell Programming and Scripting

Will files, creaetd in one function of the same script will be recognized in another function?

Dear All. I have a script, which process files one by one. In the script I have two functions. one sftp files to different server the other from existing file create file with different name. My question is: Will sftp function recognize files names , which are created in another... (1 Reply)
Discussion started by: digioleg54
1 Replies

10. Shell Programming and Scripting

Function - Make your function return an exit status

Hi All, Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition. #Body function1() { if then echo "exist" else echo "not exist" } #if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies
Helpers for manipulating Linux libnuma bitmask(3)	     Hardware Locality (hwloc)		 Helpers for manipulating Linux libnuma bitmask(3)

NAME
Helpers for manipulating Linux libnuma bitmask - Functions static inline struct bitmask * hwloc_cpuset_to_linux_libnuma_bitmask (hwloc_topology_t topology, hwloc_const_cpuset_t cpuset) " static inline struct bitmask * hwloc_nodeset_to_linux_libnuma_bitmask (hwloc_topology_t topology, hwloc_const_nodeset_t nodeset) " static inline int hwloc_cpuset_from_linux_libnuma_bitmask (hwloc_topology_t topology, hwloc_cpuset_t cpuset, const struct bitmask *bitmask) static inline int hwloc_nodeset_from_linux_libnuma_bitmask (hwloc_topology_t topology, hwloc_nodeset_t nodeset, const struct bitmask *bitmask) Detailed Description Function Documentation static inline int hwloc_cpuset_from_linux_libnuma_bitmask (hwloc_topology_ttopology, hwloc_cpuset_tcpuset, const struct bitmask *bitmask) [static] Convert libnuma bitmask bitmask into hwloc CPU set cpuset. This function may be used after calling many numa_ functions that use a struct bitmask as an output parameter. static inline struct bitmask * hwloc_cpuset_to_linux_libnuma_bitmask (hwloc_topology_ttopology, hwloc_const_cpuset_tcpuset) [static], [read] Convert hwloc CPU set cpuset into the returned libnuma bitmask. The returned bitmask should later be freed with numa_bitmask_free. This function may be used before calling many numa_ functions that use a struct bitmask as an input parameter. Returns: newly allocated struct bitmask. static inline int hwloc_nodeset_from_linux_libnuma_bitmask (hwloc_topology_ttopology, hwloc_nodeset_tnodeset, const struct bitmask *bitmask) [static] Convert libnuma bitmask bitmask into hwloc NUMA node set nodeset. This function may be used after calling many numa_ functions that use a struct bitmask as an output parameter. static inline struct bitmask * hwloc_nodeset_to_linux_libnuma_bitmask (hwloc_topology_ttopology, hwloc_const_nodeset_tnodeset) [static], [read] Convert hwloc NUMA node set nodeset into the returned libnuma bitmask. The returned bitmask should later be freed with numa_bitmask_free. This function may be used before calling many numa_ functions that use a struct bitmask as an input parameter. Returns: newly allocated struct bitmask. Author Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code. Version 1.7 Sun Apr 7 2013 Helpers for manipulating Linux libnuma bitmask(3)
All times are GMT -4. The time now is 04:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy