0

I made exe file (d.out) by compiling another program. And nlist function always returns -1. fopen func returns !=null. If it matters i compile my prog like this gcc -I/usr/include main.c -L/usr/lib/i386-linux-gnu/pkgconfig -lbsd

#include <string.h>
#include <bsd/nlist.h>
#include  <stdio.h>
#include <stdlib.h>

int test(){
    struct nlist nl[2];
    memset(&nl, 0, sizeof(nl));
    return  nlist("d.out", nl);
//  return nl[0].n_value;
}

int main(){


printf("%d \n", test());

}

1 Answers1

0

My FreeBSD man page says:

RETURN VALUES
The number of invalid entries is returned if successful; otherwise, if the file filename does not exist or is not executable, the returned value is -1.

Does d.out exist?

Jens
  • 69,818
  • 15
  • 125
  • 179