Skip to content

recognize data symbols inside import libraries - #3

Merged
dra27 merged 1 commit into
ocaml:masterfrom
fdopen:datasymbols
Apr 21, 2020
Merged

dra27 merged 1 commit into
ocaml:masterfrom
fdopen:datasymbols

Conversation

@fdopen

@fdopen fdopen commented Oct 27, 2014

Copy link
Copy Markdown

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: yallop/ocaml-ctypes#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.

@hcarty

hcarty commented Oct 14, 2016

Copy link
Copy Markdown
Member

@fdopen Are you still having this issue? I think I have run into this as well when using https://github.com/whitequark/opam-cross-windows.

@fdopen

fdopen commented Oct 14, 2016

Copy link
Copy Markdown
Author

It's still reported in the issue tracker of ctypes from time to time, see eg.: yallop/ocaml-ctypes#435

@dra27

dra27 commented Mar 17, 2018

Copy link
Copy Markdown
Member

@dra27

dra27 commented Apr 20, 2020

Copy link
Copy Markdown
Member

@fdopen - would you be happy to rebase this, and it should then be merged. I'm happy to rebase it for you if you're very reasonably otherwise engaged at the moment!

@dra27

dra27 commented Apr 20, 2020

Copy link
Copy Markdown
Member

(I have personally be using a version of it rebased on top of the 0.37 tag at dra27@6d10626)

@dra27

dra27 commented Apr 21, 2020

Copy link
Copy Markdown
Member

Thanks, @fdopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants