View Full Version : uses clause
savage
23-02-2006, 01:54 PM
www.midletpascal.com seems to have exceeded their bandwidth :(.
So am I right in thinking that in MP, the only "uses" units are Java classes? I can't seem to find a way to use a simple particle.pas unit that I want to use.
Any ideas?
jdarling
23-02-2006, 02:02 PM
I haven't tried MP at all yet, but what about the good old {$I File} method. Seems that while most low end compilers don't support Uses directly they all support include files.
PS: Savage or Will could you please put your two cents in on: http://www.pascalgamedevelopment.com/forums/viewtopic.php?t=3040 I'm quite worried that my goals and current target don't fit the contest goals, it also seems that others are moving along the same route I am.
cairnswm
23-02-2006, 02:02 PM
As far as I know you cannot include an existing unit but have to create a new unit and paste all the stuff you want into it. If I remember correctly there was a wishlist item to import existing files.
savage
23-02-2006, 02:25 PM
but have to create a new unit and paste all the stuff you want into it. If I remember correctly there was a wishlist item to import existing files.
Ah ok, just found the "new source file" option. Better than nothing I suppose.
but what about the good old {$I File} method.
I don't think MP supports include files. It can't even do compiler directives yet.
EugenioEnko
23-02-2006, 10:48 PM
I think that "uses unit.pas" is not pascal optimized and are working as C include file.
savage
23-02-2006, 11:00 PM
Btw, I can add uses particle; to my main source file and it compiles. But if I try and reference a procedure/function that exists in the particle.mpsrc file the compiler/IDE complains :(.
savage
24-02-2006, 11:46 AM
The MP site is still offline.
Has anyone managed to get uses clause and their respective function/procedures working?
cairnswm
24-02-2006, 12:48 PM
I create a new project called TEST.
Went to Project - New Source File
- Names the file TestUnitOne
Modified the file as follows:
unit TestUnitOne;
interface
{ add public declarations here }
Procedure WriteHeading;
implementation
{ add unit functions & procedures here }
Procedure WriteHeading;
Begin
DrawText('HEADING',10,10);
end;
initialization
{ add initialization code here }
end.
Went back tot he main file and modified it as follows (Uses clause and drawtext line):
program Test;
Uses
TestUnitOne;
begin
WriteHeading;
repaint;
delay(2000);
end.
Seems to work fine.
savage
24-02-2006, 01:52 PM
Don't worry it was me being a dufus. Silly typing error on my part. Thanks, I got it working.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.