compiling code programmatically lazarus / 31-LCL ---------------------------------------------------------------------- Ildus03 · 2019-06-24 10:58 Need from TSynEdit or file .pas compile the application using the built-in Lazarus or FPC compiler. Q: what class or component to use and how to implement all this?  I accept any interesting and working ideas In Russian: Нужно из TSynEdit или файл .pas скомпилировать приложение, используя встроенный компилятор Lazarus или FPC. Вопрос: какой класс или компонент использовать и как реализовать все это? Принимаю любые интересные и рабочие идеи ---------------------------------------------------------------------- Martin_fr · 2019-06-24 12:31 Maybe explain more verbose? More details? Example? Also, if this is "google translation", then add the "original language text" below the English translation, and maybe someone else can help with the translation. (But always include the English part) ---------------------------------------------------------------------- Thaddy · 2019-06-24 12:56 TprocessAsync comes to mind. ---------------------------------------------------------------------- skalogryz · 2019-06-24 13:08 Quote from: Ildus03 on June 24, 2019, 12:58:53 pmIn Russian: Нужно из TSynEdit или файл .pas скомпилировать приложение, используя встроенный компилятор Lazarus или FPC. Вопрос: какой класс или компонент использовать и как реализовать все это? Принимаю любые интересные и рабочие идеи "встроенного компилятора" Lazarus или FPC не существует. Есть или сам FPC - и его придёться вызвать как внешнее приложение (например через TProcess) Или PascalScript. Но PascalScript это не FPC, и у него есть свои ограничения. ---------------------------------------------------------------------- Ildus03 · 2019-06-27 19:04 I decided to use lazbuild it is very convenient, you only need to specify the path to the project file. Maybe someone will come in handy. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SysUtils.ExecuteProcess('E:\Lazarus\CGC (WinRar)\Test\lazbuild.exe', path to the project file .lpi); It is necessary that the program would lazbuild was in the folder with the project or above it on the branch. ---------------------------------------------------------------------- ------------------------------------------------- In Russian: Я решил использовать lazbuild это очень удобно, нужно лишь указать путь к файлу проекта. Может кому-нибудь и пригодится. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SysUtils.ExecuteProcess('E:\Lazarus\CGC (Уйнарер)\Test\lazbuild.exe', путь к файлу проекта .lpi); При этом нужно, что бы программа lazbuild была в папке с проектом или выше ее по ветви. ---------------------------------------------------------------------- skalogryz · 2019-06-28 04:15 Если будешь распростанять свою программу, не забывай, что lazbuild-у необходим настроенный Lazarus. И настроенный fpc вместе с ним. ---------------------------------------------------------------------- Thaddy · 2019-06-28 08:35 There is another option: the way fp (the text mode ide) compiles in the compiler.... That can also be done with a an editor written using synedit...... single executable... no dependencies.... ---------------------------------------------------------------------- Ildus03 · 2019-06-28 18:53 Quote from: Thaddy on June 28, 2019, 10:35:20 amThere is another option: the way fp (the text mode ide) compiles in the compiler.... That can also be done with a an editor written using synedit...... single executable... no dependencies.... Can be on much detail? ---------------------------------------------------------------------- lucamar · 2019-06-28 19:28 Very basically, fp incorporates the compiler inside itself. That is, it uses an internal compiler instead of the external one. The source code of fp shows how that is done and it's quite instructive. Google-translated: По сути, fp включает в себя компилятор. То есть он использует внутренний компилятор вместо внешнего. Исходный код fp показывает, как это делается, и это довольно поучительно. ---------------------------------------------------------------------- Thaddy · 2019-06-28 19:38 Indeed, and it is indeed quite instructive!! ---------------------------------------------------------------------- Ildus03 · 2019-06-29 17:27 Quote from: lucamar on June 28, 2019, 09:28:29 pmVery basically, fp incorporates the compiler inside itself. That is, it uses an internal compiler instead of the external one. Unfortunately, there is one problem, fp can only compile extension files .pas or .pp https://www.freepascal.org/docs- html/current/user/userse10.html#x26-330003.2 ---------------------------------------------------------------------- lucamar · 2019-06-29 18:18 Quote from: Ildus03 on June 29, 2019, 07:27:22 pmQuote from: lucamar on June 28, 2019, 09:28:29 pmVery basically, fp incorporates the compiler inside itself. That is, it uses an internal compiler instead of the external one. Unfortunately, there is one problem, fp can only compile extension files .pas or .pp https://www.freepascal.org/docs- html/current/user/userse10.html#x26-330003.2 That page talks about fpc (the command-line compiler) not fp (the text-mode IDE) and all it says is that if your source ends in .pas or .pp you can omit the extension in the invocation. If it's not, if for example it is .lpr, you must use the full name+extension, i.e. you must call it like "fpc myprogram.lpr" instead of just "fpc myprogram" Which, BTW, is how Lazarus makes its calls; if it were not admitted it would be impossible to compile a Lazarus project. FP (the text-mode IDE) had, IIRC, a problem with non-standard extensions in that it didn't highlight correctly the source  in the editor (it wasn't recognized as Pascal source). I don't remember ATM whether that was corrected, though.