2
0

Readme.txt 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. Demo for using libpas2js.dll, the dynamic library of the pas2js compiler.
  2. If you use the release, libpas2js.dll is in the bin folder.
  3. If you use trunk and used 'make all' to build you got
  4. bin\<targetos>-<targetcpu>\libpas2jslib.dll
  5. Copy that file and rename it to libpas2js.dll
  6. You can build libpas2js.dll directly by using Lazarus or lazbuild to compile
  7. compiler/utils/pas2js/pas2jslib.lpi
  8. Anyway you should now have the library:
  9. libpas2js.so on Linux
  10. libpas2js.dynlib on macOS
  11. libpas2js.dll on Windows
  12. Now compile pas2js_unitalias.lpi
  13. This creates pas2js_unitalias or under Windows pas2js_unitalias.exe.
  14. It simply passes the command line parameters to run the compiler, so it behaves
  15. pretty much like the command line compiler pas2js.
  16. With one exception:
  17. pas2jscompilerproxy.pas Function DoUnitAlias redirects searching for some units:
  18. if SameText(Old,'Test.Foo.Alias1') then
  19. New:='Bar'
  20. else if SameText(Old,'Test.Foo.Alias2') then
  21. New:='Test.Foo.SomeLongUnitName';
  22. The example unit examples/TestUnitAlias1.pas uses "Test.Foo.Alias1".
  23. Open a console aka terminal, cd to this folder and invoke the compiler:
  24. Linux/Mac:
  25. ./pas2js_unitalias -Jc -Tnodejs -Fu../../packages/rtl examples/TestUnitAlias1.pas -vt
  26. Windows:
  27. pas2js_unitalias.exe -Jc -Tnodejs -Fu..\..\packages\rtl examples\TestUnitAlias1.pas -vt
  28. You should see something like this:
  29. Log : Info: Configfile search: /home/mattias/.pas2js.cfg
  30. Log : Info: Configfile search: /home/mattias/pas2js/demo/uselibpas2js/pas2js.cfg
  31. Log : Info: Configfile search: /etc/pas2js.cfg
  32. Log : Info: Compiler exe: "/home/mattias/pas2js/demo/uselibpas2js/pas2js_unitalias"
  33. Log : Info: Using working directory: "/home/mattias/pas2js/demo/uselibpas2js"
  34. Log : Info: Using unit path: "/home/mattias/pas2js/packages/rtl"
  35. Log : Info: Output file: ""
  36. Log : Info: Searching file: examples/System.pp... not found
  37. Log : Info: Searching file: examples/System.pas... not found
  38. Log : Info: Searching file: examples/System.p... not found
  39. Log : Info: Searching file: System.pp... not found
  40. Log : Info: Searching file: System.pas... not found
  41. Log : Info: Searching file: System.p... not found
  42. Log : Info: Searching file: /home/mattias/pas2js/packages/rtl/System.pp... not found
  43. Log : Info: Searching file: /home/mattias/pas2js/packages/rtl/system.pas... found
  44. Info: DoUnitAlias Old="Test.Foo.Alias1" New="Bar"
  45. Log : Info: Searching file: examples/Bar.pp... not found
  46. Log : Info: Searching file: examples/Bar.pas... not found
  47. Log : Info: Searching file: examples/Bar.p... not found
  48. Log : Info: Searching file: Bar.pp... not found
  49. Log : Info: Searching file: Bar.pas... not found
  50. Log : Info: Searching file: Bar.p... not found
  51. Log : Info: Searching file: /home/mattias/pas2js/packages/rtl/Bar.pp... not found
  52. Log : Info: Searching file: /home/mattias/pas2js/packages/rtl/Bar.pas... not found
  53. Log : Info: Searching file: /home/mattias/pas2js/packages/rtl/Bar.p... not found
  54. Log : examples/TestUnitAlias1.pas(8,11) Error: can't find unit "Test.Foo.Alias1"
  55. Log : Fatal: Compilation aborted
  56. Error of class "ECompilerTerminate" raised when compiling : Compiler exited with exit code 6
  57. As you can see when searching unit "Test.Foo.Alias1" it searched instead for unit "Bar".