04-01-2011
You don't use "." for pointers, you use ->.
You should include external_funcs.h in load_struct.cpp and calc_struct.cpp too. Otherwise the compiler can't warn you when you create the functions differently than you specified in your header file -- that's a bug which can be a real pain to find the source of.
Beyond that, your code looks fine.
This User Gave Thanks to Corona688 For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
All,
I have a sh script of the following tune:
function a () { #functionality.. }
function b () { #functionnlity.. }
function check () { # this function checks for env and if all fine call build }
function usage () { #sh usage details }
function build () { #calls either a or b or... (5 Replies)
Discussion started by: vino
5 Replies
2. Shell Programming and Scripting
Hi,
I have a function that hold 3 arrayies.
I need to pass them to another function as an input, for further use
Could you please explain how to do that.
Thanks (5 Replies)
Discussion started by: yoavbe
5 Replies
3. UNIX for Advanced & Expert Users
I write kernel module with kernel threads using
linux/kthread.h on 2.6.* kernel
I tried to passing data between two kernel threads
with data argument of kthread_run( fun, data , NAME );
but this is not work I dont know why. I tried many possibility
and nothing works.
So I thought that... (0 Replies)
Discussion started by: marcintom
0 Replies
4. Homework & Coursework Questions
Hi All,
My latest assignment (practice not coursework!) is to write prototype interactive exam/test console application. I've used structs to store the question information (not sure if this was the best way to do it?) and I have the following code that outputs each question and it's possible... (0 Replies)
Discussion started by: pondlife
0 Replies
5. UNIX for Dummies Questions & Answers
EDIT: Nevermind, called a friend who is good at this stuff and he figured it out :D
Hi all,
So I'm trying to teach myself to write programs for unix in c. I am currently creating a program, and I need to pass a struct through a pipe, but I can't figure out how.
The struct I want to pass... (0 Replies)
Discussion started by: twnsfn34
0 Replies
6. Homework & Coursework Questions
Hi, i'm trying to copy a struct into a binary file using the unix instruction write, so i declare and fill the struct "superbloque" in one function "initSB" and then i pass the pointer to another function called bwrite (for block write) which calls write. The problem is that i call the function... (2 Replies)
Discussion started by: ignatius3
2 Replies
7. Shell Programming and Scripting
hi,
I am trying to export a variable from the parent makefile to a child instance of my makefile within the same directory.
the relevant code in my parent makefile is:
libvar := $(notdir $(basename ../src/file1))
export libvar
.PHONY: library
library:
make -f makechild libvar=file1... (0 Replies)
Discussion started by: bacpp
0 Replies
8. Programming
In a well-known book on the C language, there is an example of an efficient method for using a struct member as an argument to a function. (I'm a C noob, but I believe the correct terminology might be: use call-by-reference instead of call-by-value.) The function is printf.
Anyway, here's a... (5 Replies)
Discussion started by: uiop44
5 Replies
9. Shell Programming and Scripting
Hi,
I am a beginner in python programming. In my python script have a main function which calls several other functions. The main function gets its input by reading lines from a input text file. I call the main function for every line in input text file through a loop.
def main(line):
var1... (6 Replies)
Discussion started by: ctrld
6 Replies
10. Shell Programming and Scripting
I'm reading a text file using a while loop but when I call a function from within this loop it exits that same iteration … even though there are many more lines in the file to be read.
I thought it was something to do with the IFS setting but it appears that a function call (when run... (3 Replies)
Discussion started by: user052009
3 Replies
LEARN ABOUT DEBIAN
stack_create
STACK(9) BSD Kernel Developer's Manual STACK(9)
NAME
stack -- kernel thread stack tracing routines
SYNOPSIS
#include <sys/param.h>
#include <sys/stack.h>
In the kernel configuration file:
options DDB
options STACK
struct stack *
stack_create(void);
void
stack_destroy(struct stack *st);
int
stack_put(struct stack *st, vm_offset_t pc);
void
stack_copy(struct stack *src, struct stack dst);
void
stack_zero(struct stack *st);
void
stack_print(struct stack *st);
void
stack_print_ddb(struct stack *st);
void
stack_print_short(struct stack *st);
void
stack_print_short_ddb(struct stack *st);
void
stack_sbuf_print(struct sbuf sb*, struct stack *st);
void
stack_sbuf_print_ddb(struct sbuf sb*, struct stack *st);
void
stack_save(struct stack *st);
DESCRIPTION
The stack KPI allows querying of kernel stack trace information and the automated generation of kernel stack trace strings for the purposes
of debugging and tracing. To use the KPI, at least one of options DDB and options STACK must be compiled into the kernel.
Each stack trace is described by a struct stack. Before a trace may be created or otherwise manipulated, storage for the trace must be allo-
cated with stack_create(), which may sleep. Memory associated with a trace is freed by calling stack_destroy().
A trace of the current kernel thread's call stack may be captured using stack_save().
stack_print() and stack_print_short() may be used to print a stack trace using the kernel printf(9), and may sleep as a result of acquiring
sx(9) locks in the kernel linker while looking up symbol names. In locking-sensitive environments, the unsynchronized stack_print_ddb() and
stack_print_short_ddb() variants may be invoked. This function bypasses kernel linker locking, making it usable in ddb(4), but not in a live
system where linker data structures may change.
stack_sbuf_print() may be used to construct a human-readable string, including conversion (where possible) from a simple kernel instruction
pointer to a named symbol and offset. The argument sb must be an initialized struct sbuf as described in sbuf(9). This function may sleep
if an auto-extending struct sbuf is used, or due to kernel linker locking. In locking-sensitive environments, such as ddb(4), the unsynchro-
nized stack_sbuf_print_ddb() variant may be invoked to avoid kernel linker locking; it should be used with a fixed-length sbuf.
The utility functions stack_zero, stack_copy, and stack_put may be used to manipulate stack data structures directly.
SEE ALSO
ddb(4), printf(9), sbuf(9), sx(9)
AUTHORS
The stack(9) function suite was created by Antoine Brodin. stack(9) was extended by Robert Watson for general-purpose use outside of ddb(4).
BSD
June 24, 2009 BSD