Linux C 共享库问题(3)
I main(I argc, C *argv[])
{
clock_t st, et;
STR buffer;
I i, l1;
strcpy(buffer,"Hello World ABCDEFGHIJKLMNOPQRSTUVWXYZ");
st=clock();
for(i=0;i<NTIMES;i++) {
l1=strcasecmp(buffer,buffer);
l1=strcasecmp(buffer,"Hello World ABCDEFGHIJKLMNOPQRSTUVWXYZ Kitty"); }
et=clock();
printf("strcasecmp, %fn",((D)(et-st))/((D)CLOCKS_PER_SEC));
st=clock();
for(i=0;i<NTIMES;i++) {
l1=stricmp1(buffer,buffer);
l1=stricmp1(buffer,"Hello World ABCDEFGHIJKLMNOPQRSTUVWXYZ Kitty"); }
et=clock();
printf("stricmp1, %fn",((D)(et-st))/((D)CLOCKS_PER_SEC));
st=clock();
for(i=0;i<NTIMES;i++) {
l1=stricmp7(buffer,buffer);
l1=stricmp7(buffer,"Hello World ABCDEFGHIJKLMNOPQRSTUVWXYZ Kitty"); }
et=clock();
printf("stricmp7, %fn",((D)(et-st))/((D)CLOCKS_PER_SEC));
return(0);
}
Now for the output:
Code:
./MKTlib && ./StrICmpTest
strcasecmp, 0.000000
stricmp1, 0.020000
stricmp7, 1.910000
As you can see, the program runs perfectly. I\'m using a full and clean install of Slackware 13.1, gcc version of 4.4.4
Now for the questions:
1. Why does stricmp7 take so much longer to run then stricmp1 when the code of both is identical?
Code:
ldd StrICmpTest
linux-gate.so.1 => (0xb7794000)
libc.so.6 => /lib/libc.so.6 (0xb761b000)
/lib/ld-linux.so.2 (0xb7795000)
2. Why does libtest NOT show up in the above?
3. What can be done to fix this problem?
Thank you in advance.
本文来源:SecYe安全网[http://www.secye.com] (责任编辑:SecYe安全)