Hi,

2019/2/18 Mon 22:58:12 UTC+9 Bram Moolenaar wrote:
> Ken Takata wrote:
> 
> > 2019/2/18 Mon 9:12:03 UTC+9 h_east wrote:
> > > Hi,
> > > 
> > > 2019-2-18(Mon) 8:46:17 UTC+9 Heptite:
> > > > On Sun, 17 Feb 2019, Cesar Romani wrote:
> > > > 
> > > > > if_ruby.c:68:11: fatal error: dlfcn.h: No such file or directory
> > > > > # include <dlfcn.h>
> > > > >           ^~~~~~~~~
> > > > > compilation terminated.
> > > > > make: *** [gobjZi686/if_ruby.o] Error 1
> > > > > Error by compiling gvim.exe
> > > > 
> > > > I tracked this down to MSWIN not being defined before it is tested 
> > > > for. (MSWIN being defined in vim.h.)
> > > > 
> > > > I was able to get that one file to compile by adding a -DMSWIN on the 
> > > > command line, but that's just a workaround.
> > > 
> > > Please check with the attached patch.
> > > Thank you for reporting.
> > 
> > > +#if !(defined(WIN32) || defined(_WIN64))
> > 
> > I think this line can be simpler:
> > 
> >  #ifndef WIN32
> > 
> > Moreover, indentation is incorrect around this line.
> > I attached a patch to fix both of them.
> 
> Can we move including vim.h to the start of the file?
> Then we can also drop some other includes, such as "auto/config.h".
> 
> Would need to try it out, and possibly move things that really need to happen
> before including vim.h to above that.

I tried a bit, but it looks difficult.
It seems that ruby.h should be included before vim.h, and many definitions for
dynamic link should be defined before ruby.h.

Another solution is moving the block after including vim.h as attached patch.

Regards,
Ken Takata

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# HG changeset patch
# Parent  7772d9520bad42ff42c4e54901ddad8b4a2d14fe

diff --git a/src/if_ruby.c b/src/if_ruby.c
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -63,22 +63,7 @@
  */
 #  define RUBY_EXPORT
 # endif
-
-#if !defined(MSWIN)
-# include <dlfcn.h>
-# define HINSTANCE void*
-# define RUBY_PROC void*
-# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
-# define symbol_from_dll dlsym
-# define close_dll dlclose
-#else
-# define RUBY_PROC FARPROC
-# define load_dll vimLoadLib
-# define symbol_from_dll GetProcAddress
-# define close_dll FreeLibrary
-#endif
-
-#endif  /* ifdef DYNAMIC_RUBY */
+#endif  // ifdef DYNAMIC_RUBY
 
 /* suggested by Ariya Mizutani */
 #if (_MSC_VER == 1200)
@@ -183,6 +168,22 @@
 #include "vim.h"
 #include "version.h"
 
+#ifdef DYNAMIC_RUBY
+# ifndef MSWIN
+#  include <dlfcn.h>
+#  define HINSTANCE void*
+#  define RUBY_PROC void*
+#  define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
+#  define symbol_from_dll dlsym
+#  define close_dll dlclose
+# else
+#  define RUBY_PROC FARPROC
+#  define load_dll vimLoadLib
+#  define symbol_from_dll GetProcAddress
+#  define close_dll FreeLibrary
+# endif
+#endif  // ifdef DYNAMIC_RUBY
+
 #if defined(PROTO) && !defined(FEAT_RUBY)
 /* Define these to be able to generate the function prototypes. */
 # define VALUE int

Raspunde prin e-mail lui