alainfrisch/flexdll — pull request #3 by fdopen (2014-10-27 10:47:51+00:00)
Title: recognize data symbols inside import libraries

I can't link to certain dlls, because flexlink can't resolve the used symbols (but the gcc toolchain can deal with them).
The problem are some data symbols inside import libraries. They are prefixed with '__nm_' and are therefore not found by flexlink.

libffi-6.dll:
```
LIBRARY "libffi-6.dll"
EXPORTS
ffi_call
ffi_call_win64
ffi_closure_alloc
ffi_closure_free
ffi_closure_win64
ffi_closure_win64_inner
ffi_prep_args
ffi_prep_cif
ffi_prep_cif_core
ffi_prep_cif_machdep
ffi_prep_cif_var
ffi_prep_closure
ffi_prep_closure_loc
ffi_type_double DATA
ffi_type_float DATA
ffi_type_longdouble DATA
ffi_type_pointer DATA
ffi_type_sint16 DATA
ffi_type_sint32 DATA
ffi_type_sint64 DATA
ffi_type_sint8 DATA
ffi_type_uint16 DATA
ffi_type_uint32 DATA
ffi_type_uint64 DATA
ffi_type_uint8 DATA
ffi_type_void DATA
```

x86_64-w64-mingw32-nm.exe libffi.dll.a:
```
[...]
d000014.o:
0000000000000000 i .idata$4
0000000000000000 i .idata$5
0000000000000000 i .idata$6
0000000000000000 i .idata$7
0000000000000000 t .text
0000000000000000 I __imp_ffi_type_double
0000000000000000 I __nm_ffi_type_double
U _head_libffi_6_dll
d000013.o:
[...]
d000012.o:
0000000000000000 i .idata$4
0000000000000000 i .idata$5
0000000000000000 i .idata$6
0000000000000000 i .idata$7
0000000000000000 t .text
0000000000000000 I __imp_ffi_prep_closure
U _head_libffi_6_dll
0000000000000000 T ffi_prep_closure
```

So flexlink can resolve ffi_prep_closure, but not to ffi_type_double.
(Example error message: https://github.com/ocamllabs/ocaml-ctypes/issues/198 )

Similar case: libsqlite3.dll.a
```
d000173.o:
0000000000000000 i .idata$4
0000000000000000 i .idata$5
0000000000000000 i .idata$6
0000000000000000 i .idata$7
0000000000000000 t .text
0000000000000000 I __imp_sqlite3_temp_directory
0000000000000000 I __nm_sqlite3_temp_directory
U _head_libsqlite3_0_dll

d000172.o:
```
flexlink can't resolve `sqlite3_temp_directory`.

The supplied patch tells flexlink about the presence of the data symbols.