[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] GnuTLS support on Woe32

From: Ted Zlatanov
Subject: Re: [PATCH] GnuTLS support on Woe32
Date: Mon, 02 May 2011 13:29:35 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

On Mon, 2 May 2011 18:20:56 +0200 Juanma Barranquero <address@hidden> wrote: 

JB> On Wed, Apr 27, 2011 at 14:19, Juanma Barranquero <address@hidden> wrote:
>> GnuTLS was one of the reasons that prompted me to change
>> `image-library-alist' to `dynamic-library-alist', so yes, I plan to do
>> it if nobody beats me to it.
>> But I won't be able to spend time on that in at least a week or two,
>> perhaps more, so there's ample time for someone to step in...

JB> I'm working on this.

JB> First question: what should the code do when the gnutls library cannot
JB> be loaded at runtime? I mean, which is the single point that can
JB> return a failure exit code, let's say, GNUTLS_EMACS_ERROR_NOT_LOADED
JB> (== GNUTLS_E_APPLICATION_ERROR_MIN + 1), so the rest of the GnuTLS
JB> code is disabled?

JB> I'm thinking there will be a function init_gnutls_functions (), called
JB> from syms_of_gnutls or Fgnutls_boot, which in addition to adjusting
JB> the function pointers, sets a success/failure flag. And then, from the
JB> elisp side, either that variable of a function gnutls-is-loaded-p
JB> which the gnutls.el functions will have to consult.

All the C GnuTLS init code (currently `gnutls-boot') calls
`emacs_gnutls_global_init' *every time*, which is short enough to quote

#+begin_src c
static Lisp_Object
emacs_gnutls_global_init (void)
  int ret = GNUTLS_E_SUCCESS;

  if (!gnutls_global_initialized)
    ret = gnutls_global_init ();

  gnutls_global_initialized = 1;

  return gnutls_make_error (ret);

... and then in `gnutls-boot':

#+begin_src c
  /* always initialize globals.  */
  global_init = emacs_gnutls_global_init ();
  if (! NILP (Fgnutls_errorp (global_init)))
    return global_init;


So we just need to modify `emacs_gnutls_global_init' to load and check
the GnuTLS library and return an appropriate error (which can be any
ELisp number object, so you can attach debug info to it).  Or you can do
it once at init time, which seems less convenient to the user but less
work.  I don't have an opinion either way.

JB> Does that sound right? If so, can you take care of the gnutls.el side of 

I think gnutls.el should not know about this.  It should simply get an
error from the C layer if the library could not be loaded.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]