Loading ...
Sorry, an error occurred while loading the content.

Re: [bugreport] libcall() cannot access envrionment variable set by vim

Expand Messages
  • mattn
    ... I make sure this. created dll with: ... __declspec(dllexport) char* foo(const char* name) { return getenv(name); } ... gcc -shared -o foo.dll foo.c ... let
    Message 1 of 5 , Feb 20, 2013
    • 0 Attachment
      On Wednesday, February 20, 2013 12:06:05 AM UTC+9, Jian wrote:
      > According to MSDN, GetDOSEnvironment is 16bit-windows API and does not exist on 32bit-windows. I tried GetEnvironmentVariable() in my DLL but it still does not work.
      >

      I make sure this.

      created dll with:

      === foo.c
      --------------------------
      __declspec(dllexport)
      char* foo(const char* name) {
      return getenv(name);
      }
      --------------------------

      gcc -shared -o foo.dll foo.c

      === foo.vim
      --------------------------
      let s:libfile = substitute(expand('<sfile>'), '.vim$', (has('win32')||has('win64'))?'.dll':'.so', '')
      let $FOO=localtime()
      echo libcall(s:libfile, "foo", "FOO")
      --------------------------

      And :so % on foo.vim

      I get correct values. Probably, your dll is not depend on same msvcrt.dll which vim is used.

      --
      --
      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 vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • skyshore
      I looked the DLL dependencies via MS depends.exe, and found my compiled DLL depends on msvcrt.dll, but my gvim.exe does not have msvcrt.dll in the direct
      Message 2 of 5 , Feb 24, 2013
      • 0 Attachment
        I looked the DLL dependencies via MS depends.exe, and found my compiled DLL depends on msvcrt.dll, but my gvim.exe does not have msvcrt.dll in the direct dependency list (although some system module like shell32.dll depends on it). 

        And I use procexp tool to view the module list of the running gvim, and only the system defualt msvcrt.dll in the list.

        my gvim 7.3 is installed by the package from vim.org. I tried your codes and still nothing showed, whatever I use gcc or cl.exe to compile.

        2013/2/20 mattn <mattn.jp@...>
        On Wednesday, February 20, 2013 12:06:05 AM UTC+9, Jian wrote:
        > According to MSDN, GetDOSEnvironment is 16bit-windows API and does not exist on 32bit-windows. I tried GetEnvironmentVariable() in my DLL but it still does not work.
        >

        I make sure this.

        created dll with:

        === foo.c
        --------------------------
        __declspec(dllexport)
        char* foo(const char* name) {
          return getenv(name);
        }
        --------------------------

        gcc -shared -o foo.dll foo.c

        === foo.vim
        --------------------------
        let s:libfile = substitute(expand('<sfile>'), '.vim$', (has('win32')||has('win64'))?'.dll':'.so', '')
        let $FOO=localtime()
        echo libcall(s:libfile, "foo", "FOO")
        --------------------------

        And :so % on foo.vim

        I get correct values. Probably, your dll is not depend on same msvcrt.dll which vim is used.

        --
        --
        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 vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.



        --
        --
        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 vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
         
         
      Your message has been successfully submitted and would be delivered to recipients shortly.