$$external problem

Anything QL Software or Programming Related.
User avatar
Giorgio Garabello
Trump Card
Posts: 201
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, ITaly
Contact:

$$external problem

Postby Giorgio Garabello » Thu Mar 15, 2018 6:18 pm

It's the first time I try to create a function using the $$ external Qliberator directive.

I copied the following sample program from the manual:

50 REMark $$ external
60 DEFine Function FRA (x)
70 RETurn x-INT (x)
80 END DEFine

I compiled it and then loaded it into memory using the LRESPR command.

When I try to run it

PRINT FRA (3)
hangs on the RETURN statement with the following error: "non-numeric string", then it crashes?

I'm doing the tests on QPC2 ...

Some idea?


Derek_Stewart
Aurora
Posts: 984
Joined: Mon Dec 20, 2010 11:40 am
Location: Runcorn, Cheshire, UK

Re: $$external problem

Postby Derek_Stewart » Thu Mar 15, 2018 9:24 pm

Hi,

Try line 50 without the space between $$ external

That is:

Code: Select all

50 REMark $$external


Regards,

Derek
EmmBee
Bent Pin Expansion Port
Posts: 79
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: $$external problem

Postby EmmBee » Thu Mar 15, 2018 9:33 pm

Hi Georgio,

You need to do your tests on a real QL or Q-emuLator, and you will get the expected answers.

Unfortunately, these QLIB externals will not currently work with QPC2.
What happens is that x gets the value of an empty string,
and INT expects a numeric value, so this causes the error,
but the function would not return anyway.

EmmBee


User avatar
Giorgio Garabello
Trump Card
Posts: 201
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, ITaly
Contact:

Re: $$external problem

Postby Giorgio Garabello » Thu Mar 15, 2018 10:44 pm

these QLIB externals will not currently work with QPC2

Damn!

Are there any alternative ways to create extensions?


User avatar
pjw
Gold Card
Posts: 346
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway

Re: $$external problem

Postby pjw » Fri Mar 16, 2018 8:35 am

Giorgio Garabello wrote:
these QLIB externals will not currently work with QPC2

Damn!

Are there any alternative ways to create extensions?

Yes, in assembler ;) But why do you have to do this? It is no faster that incorporating the S*BASIC code in your (compiled) program. You could have a library of such toolkits and just paste them into your code as needed (as I do) or use Wolfgang's SBASIC linker..


Per
For every complex problem there is an answer that is clear, simple, and wrong.
- H. L. Mencken
User avatar
Peter
Super Gold Card
Posts: 599
Joined: Sat Jan 22, 2011 8:47 am

Re: $$external problem

Postby Peter » Fri Mar 16, 2018 9:14 am

EmmBee wrote:You need to do your tests on a real QL or Q-emuLator, and you will get the expected answers.
Unfortunately, these QLIB externals will not currently work with QPC2.

What is the technical reason for this?


User avatar
Giorgio Garabello
Trump Card
Posts: 201
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, ITaly
Contact:

Re: $$external problem

Postby Giorgio Garabello » Fri Mar 16, 2018 9:19 am

pjw wrote:
Giorgio Garabello wrote:
these QLIB externals will not currently work with QPC2

Damn!

Are there any alternative ways to create extensions?

Yes, in assembler ;) But why do you have to do this? It is no faster that incorporating the S*BASIC code in your (compiled) program. You could have a library of such toolkits and just paste them into your code as needed (as I do) or use Wolfgang's SBASIC linker..


Assembler?....argh! (i'm ignorant)

I wanted to create a species of "API" to facilitate the work of other programmers ....


EmmBee
Bent Pin Expansion Port
Posts: 79
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: $$external problem

Postby EmmBee » Fri Mar 16, 2018 11:22 am

Peter wrote:
EmmBee wrote:You need to do your tests on a real QL or Q-emuLator, and you will get the expected answers.
Unfortunately, these QLIB externals will not currently work with QPC2.

What is the technical reason for this?

The trouble is apparently caused by QPC2 not recognizing it has been called from the Interpreter's #0.
The code will work if called from another compiled SBASIC Qliberator job, I've just tried this.
So, these QLIB externals do actually work with QPC2, but they currently cannot be used in Interpreted SBASIC.

EmmBee


RWAP
RWAP Master
Posts: 2394
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: $$external problem

Postby RWAP » Fri Mar 16, 2018 11:41 am

Giorgio Garabello wrote:I wanted to create a species of "API" to facilitate the work of other programmers ....


Why not just leave the functions as SuperBASIC for people to incorporate within their own programs.
They could be coupled with the QL Library Manager by Ergon Development - http://www.dilwyn.me.uk/program/index.html


User avatar
Giorgio Garabello
Trump Card
Posts: 201
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, ITaly
Contact:

Re: $$external problem

Postby Giorgio Garabello » Fri Mar 16, 2018 12:21 pm

RWAP wrote:
Giorgio Garabello wrote:I wanted to create a species of "API" to facilitate the work of other programmers ....


Why not just leave the functions as SuperBASIC for people to incorporate within their own programs.
They could be coupled with the QL Library Manager by Ergon Development - http://www.dilwyn.me.uk/program/index.html


In my case it is an extension / command that acts in insertion on a Blackphonix system file ..
I want to make sure everyone can take advantage of the service but that no one can enter data that is formally wrong.
I believe that alternatively I used an executable program.

Of course it would be interesting to solve the problem of extensions!

Giorgio



Return to “Software & Programming”

Who is online

Users browsing this forum: No registered users and 2 guests