I've been using the Eclipse IDE for a few years now. When programming in C I'm used to Ctrl+Click on a symbol and Eclipse takes me to the file and line of the symbol's declaration.
Without an IDE, how do I achieve this? I'm using gcc to compile a massive FOSS project with hundreds of header files. Looking though the C files, I see functions that I would like to know more about. Finding the header file that declares said function is a tedious and manual task. Not to mention manual interpretation of macros...
GCC compiles the project and knows what the declarations are and where. Is it possible to generate a human readable index of all symbol declarations along with their filename and position for a given compilation?
Sounds like you're looking for the -aux-info flag; it will write a list of all functions declared or defined in a translation unit (including those in header files) to a specified output file.
Here's a dumb piece of code I wrote for another SO question (don't remember what it was for):
#include <stdio.h>
int main( int argc, const char *argv[] )
{
const unsigned long long lim = 2000000;
unsigned long long nums2lim[lim];
printf( "%zu\n", sizeof nums2lim );
return 0;
}
Compiling it with
gcc -o test -std=c99 -pedantic -Wall -Werror -aux-info=test.aux test.c
yields this output in test.aux:
/* compiled from: . */
/* /usr/include/libio.h:413:NC */ extern int __underflow (_IO_FILE *);
/* /usr/include/libio.h:414:NC */ extern int __uflow (_IO_FILE *);
/* /usr/include/libio.h:415:NC */ extern int __overflow (_IO_FILE *, int);
/* /usr/include/libio.h:416:NC */ extern wint_t __wunderflow (_IO_FILE *);
/* /usr/include/libio.h:417:NC */ extern wint_t __wuflow (_IO_FILE *);
/* /usr/include/libio.h:418:NC */ extern wint_t __woverflow (_IO_FILE *, wint_t);
/* /usr/include/libio.h:451:NC */ extern int _IO_getc (_IO_FILE *);
/* /usr/include/libio.h:452:NC */ extern int _IO_putc (int, _IO_FILE *);
/* /usr/include/libio.h:453:NC */ extern int _IO_feof (_IO_FILE *);
/* /usr/include/libio.h:454:NC */ extern int _IO_ferror (_IO_FILE *);
/* /usr/include/libio.h:456:NC */ extern int _IO_peekc_locked (_IO_FILE *);
/* /usr/include/libio.h:462:NC */ extern void _IO_flockfile (_IO_FILE *);
/* /usr/include/libio.h:463:NC */ extern void _IO_funlockfile (_IO_FILE *);
/* /usr/include/libio.h:464:NC */ extern int _IO_ftrylockfile (_IO_FILE *);
/* /usr/include/libio.h:482:NC */ extern int _IO_vfscanf (_IO_FILE *, const char *, __va_list_tag *, int *);
/* /usr/include/libio.h:484:NC */ extern int _IO_vfprintf (_IO_FILE *, const char *, __va_list_tag *);
/* /usr/include/libio.h:485:NC */ extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
/* /usr/include/libio.h:486:NC */ extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
/* /usr/include/libio.h:488:NC */ extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
/* /usr/include/libio.h:489:NC */ extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
/* /usr/include/libio.h:491:NC */ extern void _IO_free_backup_area (_IO_FILE *);
/* /usr/include/stdio.h:154:NC */ extern int remove (const char *);
/* /usr/include/stdio.h:156:NC */ extern int rename (const char *, const char *);
/* /usr/include/stdio.h:171:NC */ extern FILE *tmpfile (void);
/* /usr/include/stdio.h:185:NC */ extern char *tmpnam (char *);
/* /usr/include/stdio.h:213:NC */ extern int fclose (FILE *);
/* /usr/include/stdio.h:218:NC */ extern int fflush (FILE *);
/* /usr/include/stdio.h:249:NC */ extern FILE *fopen (const char *, const char *);
/* /usr/include/stdio.h:256:NC */ extern FILE *freopen (const char *, const char *, FILE *);
/* /usr/include/stdio.h:309:NC */ extern void setbuf (FILE *, char *);
/* /usr/include/stdio.h:314:NC */ extern int setvbuf (FILE *, char *, int, size_t);
/* /usr/include/stdio.h:334:NC */ extern int fprintf (FILE *, const char *, ...);
/* /usr/include/stdio.h:339:NC */ extern int printf (const char *, ...);
/* /usr/include/stdio.h:342:NC */ extern int sprintf (char *, const char *, ...);
/* /usr/include/stdio.h:349:NC */ extern int vfprintf (FILE *, const char *, __va_list_tag *);
/* /usr/include/stdio.h:354:NC */ extern int vprintf (const char *, __va_list_tag *);
/* /usr/include/stdio.h:357:NC */ extern int vsprintf (char *, const char *, __va_list_tag *);
/* /usr/include/stdio.h:365:NC */ extern int snprintf (char *, size_t, const char *, ...);
/* /usr/include/stdio.h:369:NC */ extern int vsnprintf (char *, size_t, const char *, __va_list_tag *);
/* /usr/include/stdio.h:406:NC */ extern int fscanf (FILE *, const char *, ...);
/* /usr/include/stdio.h:411:NC */ extern int scanf (const char *, ...);
/* /usr/include/stdio.h:414:NC */ extern int sscanf (const char *, const char *, ...);
/* /usr/include/stdio.h:425:NC */ extern int vfscanf (FILE *, const char *, __va_list_tag *);
/* /usr/include/stdio.h:432:NC */ extern int vscanf (const char *, __va_list_tag *);
/* /usr/include/stdio.h:437:NC */ extern int vsscanf (const char *, const char *, __va_list_tag *);
/* /usr/include/stdio.h:447:NC */ extern int fgetc (FILE *);
/* /usr/include/stdio.h:448:NC */ extern int getc (FILE *);
/* /usr/include/stdio.h:454:NC */ extern int getchar (void);
/* /usr/include/stdio.h:489:NC */ extern int fputc (int, FILE *);
/* /usr/include/stdio.h:490:NC */ extern int putc (int, FILE *);
/* /usr/include/stdio.h:496:NC */ extern int putchar (int);
/* /usr/include/stdio.h:539:NC */ extern char *fgets (char *, int, FILE *);
/* /usr/include/stdio.h:546:NC */ extern char *gets (char *);
/* /usr/include/stdio.h:596:NC */ extern int fputs (const char *, FILE *);
/* /usr/include/stdio.h:602:NC */ extern int puts (const char *);
/* /usr/include/stdio.h:609:NC */ extern int ungetc (int, FILE *);
/* /usr/include/stdio.h:617:NC */ extern size_t fread (void *, size_t, size_t, FILE *);
/* /usr/include/stdio.h:623:NC */ extern size_t fwrite (const void *, size_t, size_t, FILE *);
/* /usr/include/stdio.h:656:NC */ extern int fseek (FILE *, long int, int);
/* /usr/include/stdio.h:661:NC */ extern long int ftell (FILE *);
/* /usr/include/stdio.h:666:NC */ extern void rewind (FILE *);
/* /usr/include/stdio.h:705:NC */ extern int fgetpos (FILE *, fpos_t *);
/* /usr/include/stdio.h:710:NC */ extern int fsetpos (FILE *, const fpos_t *);
/* /usr/include/stdio.h:733:NC */ extern void clearerr (FILE *);
/* /usr/include/stdio.h:735:NC */ extern int feof (FILE *);
/* /usr/include/stdio.h:737:NC */ extern int ferror (FILE *);
/* /usr/include/stdio.h:753:NC */ extern void perror (const char *);
/* test.c:4:NF */ extern int main (int argc, const char **argv); /* (argc, argv) int argc; const char **argv; */
This flag only works for C code, though - it won't give you anything for C++.
A light-weight, hackish approach would be to grep through the header files for the function name. Linux syntax would be something like:
find . -type f -name "*.h" | xargs grep [functionName]
It's what I use for my moderately-sized projects. I can't speak to how well it would scale.
Related
I am trying to port old C code from FreeBSD into Ubuntu. The code contains calls to some functions specific for old FreeBSD C-standard library (stdlib.h). What are the analogs of these functions in modern Linux library?
char *cgetcap (char *, char *, int);
int cgetclose (void);
int cgetent (char **, char **, char *);
int cgetfirst (char **, char **);
int cgetmatch (char *, char *);
int cgetnext (char **, char **);
int cgetnum (char *, char *, long *);
int cgetset (char *);
int cgetstr (char *, char *, char **);
int cgetustr (char *, char *, char **);
int strcasecmp (const char *, const char *);
Here is my c code
#include <stdlib.h>
#include<stdio.h>
int add(int a,int b){
int sum=0;
sum = a+b;
return sum;
}
int sub(int a ,int b){
int sub=0;
sub = a-b;
return sub;
}
int main(int argc, char **argv){
int a = atoi(argv[1]);
int b = atoi(argv[2]);
printf("Sum of %d and %d = %d",a,b,add(a,b));
printf("Sub of %d and %d = %d",a,b,sub(a,b));
}
I compiled it by giving this command
gcc -ggdb calculator.c -o calculator
Then I opened in in gdb. After setting breakpoint at "main" and tried to list all the functions by the command "info functions"..But it gives a bunch of huge other functions name.Here is some of them;
All defined functions:
File ../argp/argp-fmtstream.h:
266: size_t __argp_fmtstream_point(argp_fmtstream_t);
220: int __argp_fmtstream_putc(argp_fmtstream_t, int);
207: int __argp_fmtstream_puts(argp_fmtstream_t, const char *);
230: size_t __argp_fmtstream_set_lmargin(argp_fmtstream_t, size_t);
242: size_t __argp_fmtstream_set_rmargin(argp_fmtstream_t, size_t);
254: size_t __argp_fmtstream_set_wmargin(argp_fmtstream_t, size_t);
194: size_t __argp_fmtstream_write(argp_fmtstream_t, const char *, size_t);
File ../argp/argp.h:
526: void __argp_usage(const struct argp_state *);
544: int __option_is_end(const struct argp_option *);
532: int __option_is_short(const struct argp_option *);
File ../bits/stdlib-bsearch.h:
20: void *__GI_bsearch(const void *, const void *, size_t, size_t, __compar_fn_t);
File ../csu/libc-start.c:
129:
int __libc_start_main(int (*)(int, char **, char **), int, char **, int (*)(int, char
**, char **), void (*)(void), void (*)(void), void *);
File ../elf/dl-runtime.c:
484: void _dl_call_pltexit(struct link_map *, Elf64_Word, const void *, void *);
61: Elf64_Addr _dl_fixup(struct link_map *, Elf64_Word);
154:
Elf64_Addr _dl_profile_fixup(struct link_map *, Elf64_Word, Elf64_Addr, void *, long
*);
And many more...It is just the 1/100 part
The majority of those functions come from glibc library, that is linked in runtime to every dynamic executable.
You can examine which libraries are linked by executing ldd your-executable-name and then examine reported .so files for the functions they have (by using gdb the same way).
Try to link with -Wl,--gc-sections -ffunction-sections -fdata-sections command-line options. It will remove all unused data and code and data from the executable. Then only used functions will be in your code.
I'm porting tcl/tk C headers to D and i've run into a type that doesn't seem to be defined anywhere. Inside the file tclPlatDecls.h there is the following definition:
typedef struct TclPlatStubs {
int magic;
struct TclPlatStubHooks *hooks;
#ifdef __WIN32__ /* WIN */
TCHAR * (*tcl_WinUtfToTChar) (CONST char *str, int len, Tcl_DString *dsPtr); /* 0 */
char * (*tcl_WinTCharToUtf) (CONST TCHAR *str, int len, Tcl_DString *dsPtr); /* 1 */
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, CONST char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */
int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, CONST char *bundleName, CONST char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath); /* 1 */
#endif /* MACOSX */
} TclPlatStubs;
I can't find the definition of TclPlatStubHooks. Any idea where this is? I've grep'ed the entire code base and there is no definition anywhere. Even searching on the net yields no results.
For what it's worth, I'll confirm your grep is working, I found only that one reference to it as well, in versions 8.5.15 and 8.4.20.
What may be of interest is that in 8.6.1, the definition changes to void * as seen below.
typedef struct TclPlatStubs {
int magic;
void *hooks;
#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */
TCHAR * (*tcl_WinUtfToTChar) (const char *str, int len, Tcl_DString *dsPtr); /* 0 */
char * (*tcl_WinTCharToUtf) (const TCHAR *str, int len, Tcl_DString *dsPtr); /* 1 */
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, const char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */
int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath); /* 1 */
#endif /* MACOSX */
} TclPlatStubs;
Maybe you could get away with treating it as a void *?
error when compiling kernel, this really gives me headache. couldnt figure out whats wrong. multi-line macro definition already escaped by newline.
actual error is
include/linux/mmc/sdio_func.h:169:2: error: expected identifier or '(' before ')' token
header file that trigger the error
/*
* include/linux/mmc/sdio_func.h
*
* Copyright 2007-2008 Pierre Ossman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*/
#ifndef MMC_SDIO_FUNC_H
#define MMC_SDIO_FUNC_H
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/mmc/pm.h>
struct mmc_card;
struct sdio_func;
typedef void (sdio_irq_handler_t)(struct sdio_func *);
/*
* Structure used to hold embedded SDIO device data from platform layer
*/
struct sdio_embedded_func {
uint8_t f_class;
uint32_t f_maxblksize;
};
/*
* SDIO function CIS tuple (unknown to the core)
*/
struct sdio_func_tuple {
struct sdio_func_tuple *next;
unsigned char code;
unsigned char size;
unsigned char data[0];
};
/*
* SDIO function devices
*/
struct sdio_func {
struct mmc_card *card; /* the card this device belongs to */
struct device dev; /* the device */
sdio_irq_handler_t *irq_handler; /* IRQ callback */
unsigned int num; /* function number */
unsigned char class; /* standard interface class */
unsigned short vendor; /* vendor id */
unsigned short device; /* device id */
unsigned max_blksize; /* maximum block size */
unsigned cur_blksize; /* current block size */
unsigned enable_timeout; /* max enable timeout in msec */
unsigned int state; /* function state */
#define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */
u8 tmpbuf[4]; /* DMA:able scratch buffer */
unsigned num_info; /* number of info strings */
const char **info; /* info strings */
struct sdio_func_tuple *tuples;
};
#define sdio_func_present(f) ((f)->state & SDIO_STATE_PRESENT)
#define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT)
#define sdio_func_id(f) (dev_name(&(f)->dev))
#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev)
#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d)
#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
/*
* SDIO function device driver
*/
struct sdio_driver {
char *name;
const struct sdio_device_id *id_table;
int (*probe)(struct sdio_func *, const struct sdio_device_id *);
void (*remove)(struct sdio_func *);
struct device_driver drv;
};
#define to_sdio_driver(d) container_of(d, struct sdio_driver, drv)
/**
* SDIO_DEVICE - macro used to describe a specific SDIO device
* #vend: the 16 bit manufacturer code
* #dev: the 16 bit function id
*
* This macro is used to create a struct sdio_device_id that matches a
* specific device. The class field will be set to SDIO_ANY_ID.
*/
#define SDIO_DEVICE(vend,dev) \
.class = SDIO_ANY_ID, \
.vendor = (vend), .device = (dev)
/**
* SDIO_DEVICE_CLASS - macro used to describe a specific SDIO device class
* #dev_class: the 8 bit standard interface code
*
* This macro is used to create a struct sdio_device_id that matches a
* specific standard SDIO function type. The vendor and device fields will
* be set to SDIO_ANY_ID.
*/
#define SDIO_DEVICE_CLASS(dev_class) \
.class = (dev_class), \
.vendor = SDIO_ANY_ID, .device = SDIO_ANY_ID
extern int sdio_register_driver(struct sdio_driver *);
extern void sdio_unregister_driver(struct sdio_driver *);
/*
* SDIO I/O operations
*/
extern void sdio_claim_host(struct sdio_func *func);
extern void sdio_release_host(struct sdio_func *func);
extern int sdio_enable_func(struct sdio_func *func);
extern int sdio_disable_func(struct sdio_func *func);
extern int sdio_set_block_size(struct sdio_func *func, unsigned blksz);
extern int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler);
extern int sdio_release_irq(struct sdio_func *func);
extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret);
extern u8 sdio_readb_ext(struct sdio_func *func, unsigned int addr, int *err_ret,
unsigned in);
extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret);
extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret);
extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst,
unsigned int addr, int count);
extern int sdio_readsb(struct sdio_func *func, void *dst,
unsigned int addr, int count);
extern void sdio_writeb(struct sdio_func *func, u8 b,
unsigned int addr, int *err_ret);
extern void sdio_writew(struct sdio_func *func, u16 b,
unsigned int addr, int *err_ret);
extern void sdio_writel(struct sdio_func *func, u32 b,
unsigned int addr, int *err_ret);
extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,
void *src, int count);
extern int sdio_writesb(struct sdio_func *func, unsigned int addr,
void *src, int count);
extern unsigned char sdio_f0_readb(struct sdio_func *func,
unsigned int addr, int *err_ret);
extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b,
unsigned int addr, int *err_ret);
extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func);
extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags);
#endif
line 169 is the last line of code before the #endif, but seeing it i just cant figure out whats wrong with it.
mmc_pm_flag_t type is not known to the compiler. Did you include the correct headers? If yes, check the headers and see if you need to enable some macro.
I have the following .x file called paper.x . When I create a server in rpc in order to call the function the error below occurs
paperserverproc.c:23:5: error: conflicting types for ‘add_procedure_1_svc’
paper.h:46:15: note: previous declaration of ‘add_procedure_1_svc’ was here
#include <limits.h>
struct paper_saved{
char author_name[CHAR_MAX];
char paper_title[CHAR_MAX];
int paper_id;
char paper_file_name[CHAR_MAX];
char paper_content[CHAR_MAX];
};
struct paper_info_saved{
char author_name[CHAR_MAX];
char paper_title[CHAR_MAX];
int paper_id;
char paper_file_name[CHAR_MAX];
};
struct list_papers{
paper_saved paper;
struct list_papers *next;
};
program PAPER_PROGRAM
{
version PAPER_VERSION
{
int ADD_PROCEDURE(paper_saved) = 1; /* Procedure nb */
void LIST_PROCEDURE(void)=2;
paper_info_saved INFO_PROCEDURE(int)=3;
paper_saved FETCH_PROCEDURE(int)=4;
void REMOVE_PROCEDURE(int)=5;
} = 1; /* Version nb */
} = 0x20001234; /* Program number */
I call the procedure with this way and the line 23 is the line when I declare the function as below
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "paper.h"
#include <ctype.h>
#include <limits.h>
.......
int add_procedure_1_svc(paper_saved *paper_pointer, struct svc_req *rqstp)
This is the paper.h file generated by rpcgen and I dont know what's the problem in line 46 that it mentions
/*
* Please do not edit this file.
* It was generated using rpcgen.
*/
#ifndef _PAPER_H_RPCGEN
#define _PAPER_H_RPCGEN
#include <rpc/rpc.h>
#ifdef __cplusplus
extern "C" {
#endif
struct paper_saved {
char author_name[127];
char paper_title[127];
int paper_id;
char paper_file_name[127];
char paper_content[127];
};
typedef struct paper_saved paper_saved;
struct paper_info_saved {
char author_name[127];
char paper_title[127];
int paper_id;
char paper_file_name[127];
};
typedef struct paper_info_saved paper_info_saved;
struct list_papers {
paper_saved paper;
struct list_papers *next;
};
typedef struct list_papers list_papers;
#define PAPER_PROGRAM 0x20001234
#define PAPER_VERSION 1
#if defined(__STDC__) || defined(__cplusplus)
#define ADD_PROCEDURE 1
extern int * add_procedure_1(paper_saved *, CLIENT *);
extern int * add_procedure_1_svc(paper_saved *, struct svc_req *);
#define LIST_PROCEDURE 2
extern void * list_procedure_1(void *, CLIENT *);
extern void * list_procedure_1_svc(void *, struct svc_req *);
#define INFO_PROCEDURE 3
extern paper_info_saved * info_procedure_1(int *, CLIENT *);
extern paper_info_saved * info_procedure_1_svc(int *, struct svc_req *);
#define FETCH_PROCEDURE 4
extern paper_saved * fetch_procedure_1(int *, CLIENT *);
extern paper_saved * fetch_procedure_1_svc(int *, struct svc_req *);
#define REMOVE_PROCEDURE 5
extern void * remove_procedure_1(int *, CLIENT *);
extern void * remove_procedure_1_svc(int *, struct svc_req *);
extern int paper_program_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
#else /* K&R C */
#define ADD_PROCEDURE 1
extern int * add_procedure_1();
extern int * add_procedure_1_svc();
#define LIST_PROCEDURE 2
extern void * list_procedure_1();
extern void * list_procedure_1_svc();
#define INFO_PROCEDURE 3
extern paper_info_saved * info_procedure_1();
extern paper_info_saved * info_procedure_1_svc();
#define FETCH_PROCEDURE 4
extern paper_saved * fetch_procedure_1();
extern paper_saved * fetch_procedure_1_svc();
#define REMOVE_PROCEDURE 5
extern void * remove_procedure_1();
extern void * remove_procedure_1_svc();
extern int paper_program_1_freeresult ();
#endif /* K&R C */
/* the xdr functions */
#if defined(__STDC__) || defined(__cplusplus)
extern bool_t xdr_paper_saved (XDR *, paper_saved*);
extern bool_t xdr_paper_info_saved (XDR *, paper_info_saved*);
extern bool_t xdr_list_papers (XDR *, list_papers*);
#else /* K&R C */
extern bool_t xdr_paper_saved ();
extern bool_t xdr_paper_info_saved ();
extern bool_t xdr_list_papers ();
#endif /* K&R C */
#ifdef __cplusplus
}
#endif
#endif /* !_PAPER_H_RPCGEN */
So the correct one .h file is
#include <limits.h>
struct paper_saved{
char author_name[CHAR_MAX];
char paper_title[CHAR_MAX];
int paper_id;
char paper_file_name[CHAR_MAX];
char paper_content[CHAR_MAX];
};
struct paper_info_saved{
char author_name[CHAR_MAX];
char paper_title[CHAR_MAX];
int paper_id;
char paper_file_name[CHAR_MAX];
};
struct list_papers{
paper_saved paper;
struct list_papers *next;
};
typedef int p_id;
program PAPER_PROGRAM
{
version PAPER_VERSION
{
p_id ADD_PROCEDURE(paper_saved) = 1; /* Procedure nb */
void LIST_PROCEDURE(void)=2;
paper_info_saved INFO_PROCEDURE(int)=3;
paper_saved FETCH_PROCEDURE(int)=4;
void REMOVE_PROCEDURE(int)=5;
} = 1; /* Version nb */
} = 0x20001234; /* Program number */
The function is declared as returning int:
int add_procedure_1_svc(paper_saved *paper_pointer, struct svc_req *rqstp)
but the extern as returning int*
extern int * add_procedure_1_svc(paper_saved *, struct svc_req *);
one of them must be wrong.
What does line 46 of file paper.h have? . Check the paper.h file on the line 46 to see if the function signature is same.Is it auto generated by rpcgen ?