libiberty and getopt

2004-04-29 Thread bertrand marquis
Hi, I need to compile a program using libiberty.a and the function getopt_long. When compiling with the flag -liberty my program crash because it don't take the right arguments from the command line. But without libiberty this part work before. i made a small program showing that problem,

Re: libiberty and getopt

2004-04-29 Thread bertrand marquis
Hi again, i just find the solution to my problem in fact it seems that adding: extern int optind; extern char *optarg; solve the problem. The compiler then auto-import these variables and it is working after. This problem doesn't seem to exist under linux but it could be a difference in

Re: libiberty and getopt

2004-04-29 Thread David Fritz
you refer to optarg the symbol that gets generated is __imp__optarg, which /is/ exported from libcygwin.a. The version of getopt* in libiberty refers to symbols named _opt* and not __imp__opt*. So when you link against libiberty, your program and getopt() are referring to different opt