Menu

#157 Missing import symbols for _stat64i32 and friends

closed-wont-fix
nobody
crt (86)
5
2010-04-27
2010-04-12
Anonymous
No

I'm linkng against a MSVC library that uses _findnext64i32 and friends. I used the objcopy --redefine-sym trick to replace *symbol with _$symbol and __imp_$symbol with __imp__$symbol for a handful of C Runtime functions, and that worked fine.

My problem is that the library also needs import symbols for_findfirst64i32, _findnext64i32, _stat64i32, _wstat64i32 and _longjump which aren't present in mingw64's msvcrt library (though the definitions themselves are of course present). I solved this by creating them by hand and linking my new object file. Just wanted to file a bug here and see if you guys have any suggestions other than this approach (and maybe get an answer why these aren't included in the mingw64 runtime, are they too old?)

Thanks! Here's my file:

#include <sys/stat.h>
#include <setjmp.h>

extern int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat);
extern int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat);
extern intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData);
extern int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData);
extern void __cdecl longjmp(jmp_buf _Buf, int _value);

int (*__MINGW_IMP_SYMBOL(_stat64i32))(const char *_Name,struct _stat64i32 *_Stat) = &_stat64i32;
int (*__MINGW_IMP_SYMBOL(_wstat64i32))(const wchar_t *_Name,struct _stat64i32 *_Stat) = &_wstat64i32;
intptr_t (*__MINGW_IMP_SYMBOL(_findfirst64i32))(const char *_Filename,struct _finddata64i32_t *_FindData) = &_findfirst64i32;
int (*__MINGW_IMP_SYMBOL(_findnext64i32))(intptr_t _FindHandle,struct _finddata64i32_t *_FindData) = &_findnext64i32;
void (* __MINGW_IMP_SYMBOL(longjmp))(jmp_buf _Buf, int _value) = &longjmp;

Discussion

  • Kai Tietz

    Kai Tietz - 2010-04-27
    • status: open --> closed-wont-fix
     
  • Kai Tietz

    Kai Tietz - 2010-04-27

    We redirect those symbols by intention.

    We changed just underscoring default for x64 and so the redirecting issue isn't necessary anymore. This should fix your problem. At the moment just gcc's 4.6 has this patch, but I intend to merge it back to gcc 4.5.x, too. Also you should use current binutils version for this new underscoring behavior of x64 PE-COFF.

    Regards,
    Kai

     

Log in to post a comment.

MongoDB Logo MongoDB