Suppose we have:
Code: Select all
#Include Once "SomeCode.bas"
Dim c as clr
'blah,,blah, blah
Now, if SomeCode was converted to a dll and we called that dll how do we reference clr?
I cannot find anything in Help to get me started.
Code: Select all
#Include Once "SomeCode.bas"
Dim c as clr
'blah,,blah, blah
Code: Select all
'UDT.bi
'Type declaration
Type UDT
Dim As Integer I
Declare Function returnI () As Integer
End Type
Code: Select all
'UDT.bas
'Type declaration + definition
'to be compiled with option -dll
#Include "UDT.bi"
Function UDT.returnI () As Integer Export
Return This.I
End Function
Code: Select all
'Main.bas
#Include "UDT.bi"
#Inclib "UDT"
Dim As UDT u
u.I = 123
Print u.returnI()
Sleep
Code: Select all
'colour.bas compile with -dll
union colour
as ulong c
type
as ubyte blue
as ubyte green
as ubyte red
as ubyte alph
end type
declare operator let(as ulong)
declare constructor(as ulong=0)
end union
operator colour.let(u as ulong) export
c=u
end operator
constructor colour(u as ulong) export
c=u
end constructor
Code: Select all
'test.bas
#inclib "colour"
union colour
as ulong c
type
as ubyte blue
as ubyte green
as ubyte red
as ubyte alph
end type
declare operator let(as ulong)
declare constructor(as ulong=0)
end union
dim as colour c=rgb(200,100,50) 'use constructor
print c.red,c.green,c.blue
dim as colour z
z=rgba(100,101,102,103) 'use let
print z.red,z.green,z.blue,z.alph
sleep
And simple when you know how.fxm wrote:Very short example:
This topic is rather important at the intermediate level. Some documentation page would be great.deltarho[1859] wrote:@dodicat
Magic! Thank you.
Glossary wrote:declaration
A source code statement that introduces a symbol, constant, variable, procedure, data type, or similar, to the compiler but not necessarily allocate any space for it. See Dim, Declare, Extern, Type.
definition
A source code statement (or statements) that allocates space for data or code. For example, Sub defines a procedure by allocating space for the program code it will contain. Some statements can be both a declaration and a definition. For example, Dim both declares and defines a variable.