最近在集成一个语音识别库的时候碰到了这样一个问题:
同样的代码,在两个开发平台编译生成dll之后,dll文件大小不同,而且小的文件可以在调试机中正常运行,大的在调试机中被调用的时候就会出现内存访问违例。
开发环境都是vc 6.0enterprise +windowsXP 5.1 2600
导出的makefile文件经过对比都一样,
我有点怀疑是其中的_UNICODE参数搞的鬼,因为编译的时候只有这个参数是我们后改的参数。
有个_stprintf函数里边使用了这个参数编译才避免编译不通过的问题。
下边贴上dll的dump,看看是不是哪有啥问题。
大文件 主机A
File Type: DLL  Section contains the following exports for ESRLib.dll    00000000 characteristics
    4E801D6D time date stamp Mon Sep 26 14:36:29 2011
        0.00 version
           1 ordinal base
           4 number of functions
           4 number of names    ordinal hint RVA      name          1    0 000010C3 ?ExitESR@@YAXXZ = @ILT+190(?ExitESR@@YAXXZ)
          2    1 000010C8 ?PauseESR@@YAXXZ = @ILT+195(?PauseESR@@YAXXZ)
          3    2 00001019 ?ResumeEsr@@YAXXZ = @ILT+20(?ResumeEsr@@YAXXZ)
          4    3 00001041 ?initESR@@YAXP6AXIJ@Z@Z = @ILT+60(?initESR@@YAXP6AXIJ@Z@Z)  Summary        C000 .data
        1000 .idata
       37000 .rdata
        5000 .reloc
       A6000 .text
小文件 主机BFile Type: DLL  Section contains the following exports for ESRLib.dll    00000000 characteristics
    4E812D0E time date stamp Tue Sep 27 09:55:26 2011
        0.00 version
           1 ordinal base
           4 number of functions
           4 number of names    ordinal hint RVA      name          1    0 000010C3 ?ExitESR@@YAXXZ
          2    1 000010C8 ?PauseESR@@YAXXZ
          3    2 00001019 ?ResumeEsr@@YAXXZ
          4    3 00001041 ?initESR@@YAXP6AXIJ@Z@Z  Summary        9000 .data
        1000 .idata
       37000 .rdata
        5000 .reloc
       A3000 .text