I'm working with units and I can't reference a unit inside another:
type typeA = record
I want to use this unit here:
uses A; // n.1
uses A; // n.2
procedure sampleB(myVar : typeA);
Both "uses" clauses produce a compiler error. Is there any possibility doing that?
I can compile this code using pascal compiler like FreePascal.
If it's not possible, then I have to write this code inside one big unit :(
Thanks for the help in advance.
Sure, be sure to name your units with at least 3 characters, let's say AAA and BBB.
var aaaaa: AAA.recA;
compiles fine here.
Thanks for post.
The problem exists when unit BBB is like:
uses AAA; // line n.1
procedure sampleBBB(myvar : recA); // line n.2
procedure sampleBBB(myvar : recA);
This way I can't compile. It shows me an error like: " test.mpsrc(n.1): E204 unexpected token 'uses'
I think that I need line n.1 due to param definition of sampleBBB procedure. But if I comment line n.1, it compiles OK.
The problem rises again when I write on unit BBB this:
function sampleBBB(myInt : integer) : recA; // line n.3
function sampleBBB2(myInt) : array[1..10] of recA; // line n.4
function sampleBBB(myInt : integer) : recA;
function sampleBBB2(myInt : integer) : array[1..10] of recA;
In this case, the compiler returns: " test.mpsrc(n.3): E406 unknown type 'recA' "
For line n.4, the compiler error is: " test.mpsrc(n.4): E406 unknown type 'array'
I know I can solve this using:
// The old returned value is retVar now. Passing it by reference
// due to being a record
function sampleBBB(myInt : integer; retVar : recA) : integer;
function sampleBBB2(myInt : integer; retVar : array[1..10] of recA) : integer; // line n.5
Line n.3 is solved but line n.5 instead of line n.4 doesn't work. Compiler error shows: " test.mpsrc(n.5): E202 identifier (name) expected
I don't know how to solve this problem with arrays.
Thanks for your answer and waiting your helping hand :)
MIDletPascal, and it's pascal dialect, has it's idiosyncrasies and some limitations too. It seems you are facing them, but the bad new is that there is not enough people using MP nowadays to assist you.
Anyway, here is my help this time. The workaround to the issue you couldn't solve is to define a new type:
someName = array of recA;
and use that new type in your parameter:
function sampleBBB2(myInt : integer; retVar : someName) : integer;
Btw, and despite the lower amount of developers using MP actively (J2ME as a platform is mostly dead now), I will try to reach the final release of the 3.5 version. It will be really hard, but I will try it.
Thanks and good luck with your MP projects.
Thanks for this solution. I'm going to try more small projects with MidletPascal.
I hope this project can walk for some years :)
Thank you for your job developing this project.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.