HIX Vrs. 1.1 - Pluggins

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!
Post Reply
User avatar
Carles
Posts: 1298
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona
Contact:

HIX Vrs. 1.1 - Pluggins

Post by Carles »

Hi,

Version 1.1 has the new loader command. This lets us pre-load stuff when we start up the server - different PRG/HRB files with functions that we can use in our program.

For example: I've got an index.html file where I inject some PRG code. In that code, I'm calling a function called mylib1().

Code: Select all | Expand

<html>
<h1>Loading modules</h1><hr>

<?prg 
    local cHtml := mylib1()
	
retu cHtml 
?>
<hr>

So, if I haven't defined this function in Harbour, HIX will throw an error saying it doesn't know what this function is.

Image

I'm going to create 2 files with functions that I'll use in my app.

mylib1.prg

Code: Select all | Expand

function mylib1()
retu mylib2()

mylib1() calls a function mylib2() that will be in another file.

mylib2.prg

Code: Select all | Expand

function mylib2()
retu 'From mylib2() => ' + dtoc(date()) + ' ' + time()

Now the only thing left is to use the "loader" command to tell it to load these modules on startup.

Code: Select all | Expand

   Root: /        Description 
════════════════════════════════════════
   mylib1.prg     Test lib1 
   mylib2.prg     Test lib2

When we start the server, the page will run properly.

Image

Now HIX can run modules in HRB format. This means that if we specify .hrb files in the loader, HIX will automatically handle it - if there's a same-named .prg file, it'll load, compile, and save it. This way we can create our HRBs without worrying about the process. And when we publish the app, we could protect the PRG source code by only distributing the HRB files!

C.

Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
asesormix
Posts: 22
Joined: Wed Feb 12, 2020 4:55 pm

Re: HIX Vrs. 1.1 - Pluggins

Post by asesormix »

Muy bueno.
Gracias

Adolfredo Martinez
Posts: 141
Joined: Fri Feb 15, 2019 1:37 pm
Location: Aracataca-Colombia

Re: HIX Vrs. 1.1 - Pluggins

Post by Adolfredo Martinez »

Charly Excelente

Corriendo Perfectamente.

Adolfredo Martinez
Posts: 141
Joined: Fri Feb 15, 2019 1:37 pm
Location: Aracataca-Colombia

Re: HIX Vrs. 1.1 - Pluggins

Post by Adolfredo Martinez »

Image

Post Reply