[英]nlist function always returns -1
I made exe file (d.out) by compiling another program. 我通过编译另一个程序制作了exe文件(d.out)。 And nlist function always returns -1.
而且nlist函数始终返回-1。 fopen func returns !=null.
fopen函数返回!= null。 If it matters i compile my prog like this
gcc -I/usr/include main.c -L/usr/lib/i386-linux-gnu/pkgconfig -lbsd
如果重要的话,我像这样编译我的编
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());
}
My FreeBSD man page says: 我的FreeBSD手册页说:
RETURN VALUES
返回值
The number of invalid entries is returned if successful;如果成功,则返回无效条目的数量;否则,返回0。 otherwise, if the file filename does not exist or is not executable, the returned value is -1.
否则,如果文件文件名不存在或不可执行,则返回值为-1。
Does d.out
exist? d.out
是否存在?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.