[Oberon] Oberon compiler futures

Bob Walkden bob at web-options.com
Sun Dec 23 08:31:48 CET 2012


> From: Srinivas Nayak [mailto:sinu.nayak2001 at gmail.com]
> 
> Dear All,
> 
> Is it not possible to call C APIs from Oberon?
> I mean, somehow interfacing to C libraries?
> I have no knowledge if it is doable or not, just got an idea!
> 

this depends on which system your Oberon is running on, because of course
the system has to be able to run the C code as well as the Oberon code. If,
for instance, you are running native Oberon - that is, the Oberon operating
system on otherwise bare hardware, then Oberon is all you have. 

If you're running it on top of Linux or Windows or something like that, or
if you're running Blackbox, then in general yes, you can interface to the C
libraries, and it should be described in your documentation.

If you're running GPCP for .Net or the JVM then I guess you have the
facilities of those VMs available for running code written in other
languages.

In Blackbox the help system says this about calling the Windows API using C
conventions. You can write your own interfaces to other DLLs, of course:

"Windows Programming Interfaces

The Win subsystem contains the interface modules for the various Windows
programming interfaces. The following table shows the available modules and
a short desription of their contents:

module	contents

WinApi	basic data types, error codes, basic Win32 functionality
WinDlg	common dialog box library
WinCtl	common controls
WinOle	basic COM and OLE interfaces
WinOleDlg	OLE dialogs (OleUI...)
WinOleAut	OLE automation interfaces	
WinOleCtl	OLE controls interfaces
WinRpc	remote procedure call functions
WinNet	networking and socket functions
WinMM	multimedia services
WinCmc	Messaging Application Programming Interface (MAPI)
WinSql	Database services (ODBC)


Naming Conventions

Names are generally the same as in the corresponding C header and help
files. An exception applies to pointers which are always named after the
structure they point to with a "Ptr" prefix.
Example:

RECT = RECORD [untagged] left, top, right, bottom: INTEGER END;
PtrRECT = POINTER TO RECT;


Parameters

Parameters of pointer type are represented as variable parameters
(VAR/IN/OUT) whenever possible.


Pointers to Pointers

Pointers to pointers or basic types cannot be declared directly in Component
Pascal. A type of the form
p: POINTER TO ARRAY [untagged] OF BaseType;
is used instead. You can use the form p[0] to dereference such a pointer."


B




More information about the Oberon mailing list