From: Juanma Barranquero <lekktu@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Problem with image libraries on Windows (reprise)
Date: Thu, 16 Jun 2005 10:39:15 +0200 [thread overview]
Message-ID: <f7ccd24b050616013966919c0a@mail.gmail.com> (raw)
In-Reply-To: <42B0F608.6030307@comcast.net>
On 6/16/05, David Hunter <hunterd42@comcast.net> wrote:
> As long as your application and all dependent libraries dynamically
> link to the CRT (MSVCRT.DLL), then all application and library code
> can share FILE pointers. However, if an application or library (module)
> statically links to a CRT (LIBC[MT].LIB), then that module must keep
> its FILE pointers to itself, as no other CRT library (static or dynamic)
> will be able to use them.
Very, very interesting:
1) MinGW-built Emacs: depends on MSVCRT.DLL
2) MSVC-built Emacs: doesn't depend on MSVCR*.DLL (it's linked with LIBC.LIB)
3) Binary tarballs of GnuWin32 image libraries (MinGW): depend on MSVCRT.DLL
4) My MSVC-built image libraries (.NET 2003): depend on MSVCR71.DLL
So 1) is compatible with 3) and would break with 4). OTOH, 2) should
break with 3) and 4). And that's *exactly* what I'm seeing. Thanks!
> This issue is not limited to FILE pointers, but also extends to include most
> CRT resources, including memory (malloc/free). You must not call one
> CRT's malloc and pass the block to another CRT's free; it won't work.
Fortunately this is not happening. The image libraries do their own
memory handling.
> The moral of this story: Encapsulate, obfuscate, and hide CRT resources.
Yeah.
In this case, the moral is: on Windows builds, we *cannot* rely on
passing FILE * to any image library (or any other library whatsoever)
because we cannot guarantee the libraries will use the same CRT. So we
have to go the alternate datasource route (that's what my patches
implement).
Thanks for a illuminating and very informative posting.
--
/L/e/k/t/u
next prev parent reply other threads:[~2005-06-16 8:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-15 10:34 Problem with image libraries on Windows (reprise) Juanma Barranquero
2005-06-15 10:34 ` Juanma Barranquero
2005-06-15 10:35 ` Juanma Barranquero
2005-06-16 3:46 ` David Hunter
2005-06-16 8:39 ` Juanma Barranquero [this message]
2005-06-22 13:18 ` Juanma Barranquero
2005-10-05 14:46 ` Juanma Barranquero
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f7ccd24b050616013966919c0a@mail.gmail.com \
--to=lekktu@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).