bug-make
[Top][All Lists]
Advanced

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

Re: "load" on Windows


From: Gisle Vanem
Subject: Re: "load" on Windows
Date: Sat, 5 Oct 2013 14:33:26 +0200

"Eli Zaretskii" <address@hidden> wrote:

Well, the tests in the test suite that test this feature did work for
me at some point, so you may wish first to verify they do for you, and
then compare your extension with the ones used by the test suite, to
see what's different.

Well this is just silly. I've added tracing code a lot of places (enabled
by option --trace) . I do see my mk_test_gmk_setup() gets called, but not the new function added by gmk_add_function().
gmk_add_function() calls define_new_function(), but therein I see a:
 ent->fptr.alloc_func_ptr = func;

What about setting:
 ent->fptr.func_ptr = func;

too? How else is the new function supposed to be called? I don't understand
this contorted logic. Isn't a new function supposed to extend (and possibly
modify) the 'function_table' used from expand_builtin_function()? Thus possibly replacing a built-in? Please somebody clarify.

For reference, here is my complete mk_test.c:

 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include "gnumake.h"

 #define EXPORT __declspec(dllexport)

 EXPORT int plugin_is_GPL_compatible;

 static char *hello_world (const char *func_name, int argc, char **argv)
 {
   char *buf = gmk_alloc(1000), *p = buf;
   int  i;

   fprintf (stdout, "hello_world() called: %s\n", func_name);

   for (i = 0; i < argc; i++)
   {
     fprintf (stdout, "argv[%d]: %s\n", i, argv[i]);
     p += sprintf (p, "%s+", argv[i]);
   }
   return (buf);
 }

 EXPORT int mk_test_gmk_setup (const gmk_floc *flocp)
 {
   gmk_add_function ("hello_world", hello_world, 0, 255, 0);
   fprintf (stdout, "\"%s()\" called from %s (%lu)\n",
            __FUNCTION__, flocp->filenm, flocp->lineno);
   return (1);
 }

--gv





reply via email to

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