Menu

#36 #! vvp for Windows

closed
Cary R.
None
4
2011-03-16
2011-02-14
guardus
No

The standard MS Windows command shell does not support hashbang (#!), but the MSYS bash shell does. So changing the Windows comment header in the vvp file shouldn't change anything for Windows command shell users, but allows MSYS (and any other shells that support #!) to directly execute the vvp file. The following works for me under MSYS bash in Windows.

The attached patch to tgt-vvp/vvp.c works for me with MinGW. But changing the header to just "#! vvp" might be a little more portable.

Discussion

  • guardus

    guardus - 2011-02-14
     
  • Cary R.

    Cary R. - 2011-02-17
    • milestone: --> devel_(Next_Release)
     
  • Cary R.

    Cary R. - 2011-02-17

    This only works because you didn't relocate the executable. We probably need something a bit more complicated to handle the fact that the binary directory at compile time may not be the final binary directory. Basically for MinGW, we need to look in the registry for the binary directory and if it's not found then fall back to the compile time path. We also need to make sure that the suffix is handled correctly. Neither Steve or I have been compiling Icarus using MinGW so we may need you to test any changes we come up with or you can try this yourself. Look in the driver-vpi directory for information on the Icarus registry keys, etc.

    I've marked this for development, but I believe any change should also be applied to version 0.9.

     
  • Stephen Williams

    • priority: 5 --> 4
     
  • Stephen Williams

    Frankly, I've never liked the #! trick for generated vvp files. I always use the "vvp" command directly, since there are command line flags to the vvp command that I often use. If there is a trivial way to get this to work under Windows, then that's OK, but unless there is a huge outcry, I'd give this a low priority.

     
  • Cary R.

    Cary R. - 2011-02-25

    I think we should patch the compiler to put in the #! for MSYS users and document in the code that this does not currently work with the general windows relocation functionality. Relocation is likely not going to be used with MSYS so there should not be any problems. I'll try to find some time later tonight to to get this all together. I think we want a patch for all the active versions.

     
  • Cary R.

    Cary R. - 2011-02-25
    • assigned_to: nobody --> caryr
     
  • guardus

    guardus - 2011-02-25

    Originally, I did not consider the situation where Icarus is installed with the installer (not user compiled). But now I think it might be better to use "#! /usr/bin/env vvp". So as long as the MSYS, cygwin, or whatever shell path includes icarus/bin, then it should work and avoids an absolute path.

    I agree this is low priority.

    Thanks for all your effort on a great tool.

     
  • Cary R.

    Cary R. - 2011-03-16
    • status: open --> closed
     
  • Cary R.

    Cary R. - 2011-03-16

    I've basically submitted your patch for the various Icarus versions. I opted not to use env since I'm not sure how portable that is. For now if the code is relocated then you need to use vvp. I'm guessing most people using a relocated version of Icarus are not compiling Icarus them self and they may not even be using the MinGW environment so the #! line is likely useless. If this does come up again then we can look at adding code to extract the relocated path from the registry with a fall back to the compiled in path.

     

Log in to post a comment.