Web lists-archives.com

Re: GTK+ mingw32 dynamic linking conflict (cairo/pangocairo)




Thanks Chun-wei,

Dependency Walker reports that `libglib-2.0-0.dll' is dependent on `MSVCRT.DLL', without any version numeral. `vcruntimeXXX.dll' is not listed as a dependency.

There are no file descriptors/handles explicitly passed between my application's code and the `pango-cairo' API calls.

A simple debug code fragment I use is as follows:

cairo_surface_t *surface;
cairo_t *cr;
cairo_status_t status;

surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 390, 60);
status = cairo_surface_status(surface);

cr = cairo_create(surface);
status = cairo_status(cr);

cairo_set_source_rgba(cr, 0, 0, 0, 1);
status = cairo_status(cr);

cairo_rectangle(cr, 175, 10, 40, 40);
status = cairo_status(cr);

cairo_fill(cr);
status = cairo_status(cr);

cairo_surface_flush(surface);
status = cairo_surface_write_to_png(surface, "f:\\cairo_test.png");

cairo_destroy(cr);
cairo_surface_destroy(surface);

This produces a transparent PNG file when linked against the MSYS2 binaries, where an image of a black square is expected.

I have managed to produce the PNG containing the expected black square when building against `gvsbuild' binaries, but these binaries are not compatible across all test environments (hence why I am trying to use the official binaries).

On 7 September 2017 at 04:17, Chun-wei Fan (范君維) <fanc999@xxxxxxxxxxxx> wrote:
Hi Jeffrey,

As far as I understand, Tarnyko's binaries are built with MSYS2, so I think the .lib files are generated (with Visual Studio's lib.exe) as a convenience to people using Visual Studio, but the things that LRN mentioned should always be taken into account when trying to use MSYS2/MinGW (or mingw-w64)-built binaries with Visual Studio builds.

Dependency Walker would be the tool that you want to use to check on which msvcrt(xx).dll (or vcruntime140.dll or so) that the binaries (with their dependencies) link to.

Since tracking down such incompatibilities can become quite hard (as it actually goes down into the CRT implementation quite a bit), probably I would want to look carefully that file descriptors/handles especially are not passed between your MSVC-built program and the MSYS2-built binaries.  Do make sure that you are using a single DLL for the same library (.lib files in this case simply points the built code to the DLL that they are tied to--so use the same GLib DLL throughout, for example, and make sure dependencies depend on those same DLLs, this may sound not so bright but can catch people off guard).

There is ongoing work to support building the GTK+ (albeit 4.x only), with its gnome.org dependencies with Meson with full support for Visual Studio, so do take a look at that, too.

It would be best if you can have a minimal sample of the code that is causing the problem for you.

With blessings, and cheers!


_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list