[SOLVED] InstantFPC usage under Windows lazarus / 67-Windows ---------------------------------------------------------------------- Roland57 · 2014-08-23 05:28 Hello! I try to use InstantFPC under Windows (8.1). The documentation says that "this tool allows to run pascal program as scripts under Linux, BSD, OS X and Windows". But the method described is only for Linux: Code: [Select][]$ chmod a+x hello.pas []$ ./hello.pas Is it really possible tu run Pascal programs as scripts under Windows, and how? ---------------------------------------------------------------------- Roland57 · 2014-08-23 07:12 I tried also to execute a sample (envvars.pas) from Lazarus ("execute as an InstantFPC program"). I got an error message: "program Instant FPC not found". I compiled InstantFPC and pasted the executable 1° to FPC\bin directory 2° to the source code directory: I still get the same error message. ---------------------------------------------------------------------- ChrisF · 2014-08-23 12:51 As instanfpc.exe is now by default in the fpc binary directory, and as you need fpc too for the compilation, you should add the the fpc binary directory to your path, before calling instantfpc. Add also a path for the cache directory using the INSTANTFPCCACHE environment variable. For instance, a setup file sample (adapt it to your own needs). File: ifpcs.bat Code: [Select]set path=%path%;c:\lazarus\fpc\2.6.4\bin\i386-win32 set INSTANTFPCCACHE=.\cache After having run this setup file in a cmd box, you can now compile (and theoretically run) your program in this cmd box: Code: [Select]instantfpc mypgm.pas Anyway, the executable is created, but there is an error when it's copied into the cache directory: Quoteunable to move "[mycache]\__tmpxxxx\mypgm" to "[mycache]\mypgm" However, you can still get it from the __tmpxxxx subdirectory, as it's not deleted. Sorry, I've not been able to solve this error during my quick tests... ---------------------------------------------------------------------- Roland57 · 2014-08-23 15:32 @ChrisF Thank you for your answer and the detailed description. I tried the commands that you suggested and it did exactly what you said. The problem is half solved. ---------------------------------------------------------------------- ChrisF · 2014-08-23 16:44 This error is consecutive to the new version of InstantFPC: Code: [Select]const   Version = '1.3';   // 1.3 compile in a separate directory, so that parallel invocations do not overwrite link.res files And there are several errors with this new version: -the '.exe' extension for Windows executable files is not added when moving the output file from this new separate directory to the cache directory (if InstantFPC is running in Windows, of course): Code: [Select]      // move from build directory to cache       if not RenameFile(BuildOutputFilename,OutputFilename) then begin         writeln('unable to move "',BuildOutputFilename,'" to "',OutputFilename,'"'); -anyhow, this moving is using a rename operation (quicker than a copy), but the former file (if already present in the cache) is not deleted first. Which gives another error during this operation, after the first call, -and finally the deletion of the whole separate directory (i.e. __tmpxxxx ) is not OK because Windows is returning an ERROR_SHARING_VIOLATION (probably related to the FPC compiler operation, I guess): Code: [Select]  if not RemoveDir(Directory) then begin     writeln('unable to delete directory "'+Directory+'"'); That makes a lot of bugs, and I've still not succeeded to fix the last one (i.e. directory deletion). You should use the version coming with the 2.6.2 version of FPC instead (i.e. InstantFPC version 1.2). This one is working properly. I've got positive tests with it: - take the source code of FPC 2.6.2, - extract the InstantFPC source (found in 'utils'), - and recompile it: fpc InstantFPC Note: don't forget to replace the current InstantFPC.exe file present in your FPC binary directory with this one (i.e. version 1.2), if you plan to use it instead. ---------------------------------------------------------------------- Roland57 · 2014-08-23 21:16 Thank for your work. I compiled InstantFPC from 2.6.2.source. Now it works without error. Great!