Run Time Compiler
Run Time Compiler
Hi
I would like to request the ability to compile code at run time. I could write code using my PB application and then compile and run it from within that application. This would allow me to execute code dynamically based on conditions that arise during the execution of my application.
Thanks,
Simon
I would like to request the ability to compile code at run time. I could write code using my PB application and then compile and run it from within that application. This would allow me to execute code dynamically based on conditions that arise during the execution of my application.
Thanks,
Simon
Simon White
dCipher Computing
dCipher Computing
Re: Run Time Compiler
I think that there will never be:
But you can use this project:
Script with PB-Syntax
For that is a similar resultat!Is it allowed to use DLLs made with PureBasic in other projects ?
Generally yes. You can make DLLs including PureBasic commands for your own projects without any restrictions. But it's not allowed to release simple "wrapper" Dlls to include PureBasic commands in other programming languages.
But you can use this project:
Script with PB-Syntax
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Run Time Compiler
HI
I guess I was not thinking of making a simple wrapper but I see your point. I was thinking more along the lines of what you can do in dynamic languages. I often store code in a database or create scripts on the fly using Visual FoxPro which then compiles and executes the code at runtime. In fact there is a specific command called "ExecScript" which compiles and runs the program code you pass to it. This allows a high degree of customization in your application that the user can control. So I was thinking it would be nice to have some kind of compiling ability from within an application. You could even put code in web-pages and execute it on the server at runtime this way.
Simon
I guess I was not thinking of making a simple wrapper but I see your point. I was thinking more along the lines of what you can do in dynamic languages. I often store code in a database or create scripts on the fly using Visual FoxPro which then compiles and executes the code at runtime. In fact there is a specific command called "ExecScript" which compiles and runs the program code you pass to it. This allows a high degree of customization in your application that the user can control. So I was thinking it would be nice to have some kind of compiling ability from within an application. You could even put code in web-pages and execute it on the server at runtime this way.
Simon
Simon White
dCipher Computing
dCipher Computing
Re: Run Time Compiler
That looks nice
But unlike the now defunct Dracscript, this one does not include source (?) Any english translation for it?

Re: Run Time Compiler
If you want a dynamic language, use a dynamic language.
Or you could make your own scripting language.

Or you could make your own scripting language.
Re: Run Time Compiler
Hi
I do not particularly want a dynamic language but the ability to compile code at runtime opens up a lot of opportunities. So I see no reason why there should be artificial barriers in any programming language so if it is possible to compile code at runtime then why not allow it. If you are worried about someone shipping your compiler inside a small wrapper then I think you could charge extra for this function or offer a lite version of the compiler by creating some new functions in PB for this purpose. I for one would not mind paying extra for such functionality.
Simon
I do not particularly want a dynamic language but the ability to compile code at runtime opens up a lot of opportunities. So I see no reason why there should be artificial barriers in any programming language so if it is possible to compile code at runtime then why not allow it. If you are worried about someone shipping your compiler inside a small wrapper then I think you could charge extra for this function or offer a lite version of the compiler by creating some new functions in PB for this purpose. I for one would not mind paying extra for such functionality.
Simon
Simon White
dCipher Computing
dCipher Computing
Re: Run Time Compiler
You would need to ship the compiler, the FASM assembler, POLINK and God knows how many import libs, other static libs and PB user-libs. The fact that those who purchase your application then get a copy of PB into the mix... Not going to happen imo.
Why not just tell your customers to purchase PB and have that running alongside your app and they can then compile away to their hearts content?
Why not just tell your customers to purchase PB and have that running alongside your app and they can then compile away to their hearts content?
I may look like a mule, but I'm not a complete ass.
Re: Run Time Compiler
Actualy that sounds horribly unsecure.swhite wrote: You could even put code in web-pages and execute it on the server at runtime this way.
Can you show a practical example of how this would be used?
I cant think of any situation i would need runtime compiling.
Re: Run Time Compiler
Do you mean something like that?swhite wrote:Hi
I would like to request the ability to compile code at run time. I could write code using my PB application and then compile and run it from within that application. This would allow me to execute code dynamically based on conditions that arise during the execution of my application.
Thanks,
Simon
Code: Select all
;your code...
PureEXE_Open("test.exe")
PureEXE_AddImport("user32.dll", "MessageBoxA", 4, "MsgBox")
PureEXE_AddConstant("MB_OK", 0)
;your code...
;bla, bla, bla
if banana
PureEXE_AddString("title", "Message")
PureEXE_AddString("text", "Hello User!")
else
PureEXE_AddString("title", "Hint")
PureEXE_AddString("text", "Go away!")
endif
;your code...
;more bla, bla, bla
PureEXE_Write("MsgBox(0,text,title,MB_OK)")
;your code...
;even more bla, bla, bla
PureEXE_Close()
;end of example...
fsw
Re: Run Time Compiler
Hi
Here is a real example. I have an application that must get data from remote sites. The sites are serial devices which require you to login and issue commands to retrieve the data. Since I do not have access to all the various versions of the hardware there are times when the prompts received from the device are different from what I expect. So I store the code used to retrieve the information in a database. When the user uses my program to retrieve the data it copies the code from the database to a file, then compiles the file and runs it. If the hardware is based on a version that I have not seen before the code in the database can be changed to accommodate the hardware. This way I can have a standard application that can be customized to the user's situation. The users does not have to wait for me to modify my code and supply a new version of the program. Eventually if I find that this version of the hardware is used a lot by my customers I may choose to modify my application and make it part of the standard application.
I do not use the run time compiling to allow the users to generate their own code but rather as a means to customizing a standard application to specific user's environment as in the situation above.
Simon
Here is a real example. I have an application that must get data from remote sites. The sites are serial devices which require you to login and issue commands to retrieve the data. Since I do not have access to all the various versions of the hardware there are times when the prompts received from the device are different from what I expect. So I store the code used to retrieve the information in a database. When the user uses my program to retrieve the data it copies the code from the database to a file, then compiles the file and runs it. If the hardware is based on a version that I have not seen before the code in the database can be changed to accommodate the hardware. This way I can have a standard application that can be customized to the user's situation. The users does not have to wait for me to modify my code and supply a new version of the program. Eventually if I find that this version of the hardware is used a lot by my customers I may choose to modify my application and make it part of the standard application.
I do not use the run time compiling to allow the users to generate their own code but rather as a means to customizing a standard application to specific user's environment as in the situation above.
Simon
Simon White
dCipher Computing
dCipher Computing
Re: Run Time Compiler
The easiest way of doing it is to create a pb inc file with some constants that are used when compiling utilizing some CompilerIf/CompilerElse/etc.
When a change is needed (automatically) write a new inc file (based on the findings) with the desired constants and (automatically) recompile the pb program on your machine.
When a change is needed (automatically) write a new inc file (based on the findings) with the desired constants and (automatically) recompile the pb program on your machine.
Re: Run Time Compiler
Hi
The problem with that approach is that my code becomes loaded with all kinds of customer specific customizations. If you have hundreds of clients all with customization the application code becomes bloated. So that is why I leave the customizations in the customer's database so that it does not affect my code.
Simon
The problem with that approach is that my code becomes loaded with all kinds of customer specific customizations. If you have hundreds of clients all with customization the application code becomes bloated. So that is why I leave the customizations in the customer's database so that it does not affect my code.
Simon
Simon White
dCipher Computing
dCipher Computing
Re: Run Time Compiler
You dont need runtime compiling for that. Just store a dll in the database download it and load it. It's the same you just skip the runtime compile.
Re: Run Time Compiler
what about other kind of code like any code to be executed dyncamially?
PUREBASIC is AWSUM