Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recognize data symbols inside import libraries #3

Merged
merged 1 commit into from Apr 21, 2020

Conversation

fdopen
Copy link

@fdopen fdopen commented Oct 27, 2014

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
Copy link
Member

hcarty commented Oct 14, 2016

@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
Copy link
Author

fdopen commented Oct 14, 2016

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

@dra27
Copy link
Member

dra27 commented Mar 17, 2018

There's a similar patch used in Cygwin: https://github.com/cygwinports/flexdll/blob/master/0.35-data-auto-imports.patch

@dra27
Copy link
Member

dra27 commented Apr 20, 2020

@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
Copy link
Member

dra27 commented Apr 20, 2020

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

@dra27
Copy link
Member

dra27 commented Apr 21, 2020

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.

None yet

3 participants