A Brief Note on Modules

Started by Charles Pegge, February 01, 2025, 01:36:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Charles Pegge

Modules and Interfaces are currently null defined but you can use these terms to mark modular sections of your code.

inner and end inner are the same as scope and end scope. They isolate the internal content of the module and make it invisible to the code on the outside.

This code demonstrates how to expose variables and functions to the outside of the module by using pointer variables and declarations, and providing linkage.

Using Basic syntax:

==========
module 'mm
==========

interface
  dim as int ptr aa
  declare function ptr ff() as string
end interface

inner
  int a : @aa=@a
  function f() as string, link @ff
    return "ok"
  end function
  a=123
end inner

==============
end module 'mm
==============
'
'test
print aa   '123
print ff() 'ok