[Oberon] Oberon for a C++ user.

Chris Burrows chris at cfbsoftware.com
Sat Oct 1 07:57:42 CEST 2016


Joerg,

OK - you may well be onto something here but it is incomplete as it is. Something has to import Square so that the module body is executed, or you need an exported procedure in Square that is called from the OS. 

Note: there are a couple of semicolons missing and Init must be exported.

Chris.

> -----Original Message-----
> From: Jörg Straube [mailto:joerg.straube at iaeth.ch]
> Sent: Saturday, 1 October 2016 2:22 PM
> To: chris at cfbsoftware.com; ETH Oberon and related systems
> Subject: Re: [Oberon] Oberon for a C++ user.
> 
> Chris
> 
> Here a possble example that might cause issues:
> 
> MODULE Figure;
> TYPE
>   DrawProc = PROCEDURE;
>   Figure = POINTER TO FigureDesc;
>   FigureDesc = RECORD
>     next: Figure;
>     draw: DrawProc
>   END;
> VAR list: Figure;
> PROCEDURE Init(d: DrawProc)
>   VAR f: Figure;
>   BEGIN
>     NEW(f); f.next := list; list := f;
>     f.draw := d
>   END Init;
> BEGIN list:= NIL END Figure.
> 
> MODULE Square;
> IMPORT Figure;
> PROCEDURE DrawSquare;
>   BEGIN (* do what ever you
>     need to do to draw a square *)
>   END DrawSquare
> BEGIN
>   Figure.Init(DrawSquare)
> END Square.
> 
> Now you could run Square and unload Square. The list in Figure has a
> reference to unloaded code.
> 
> J rg
> 




More information about the Oberon mailing list