dev.kanngard.net make sure you visit my new blog at: johankanngard.net

Short tip: Execute does not run the Initialize method

by Johan Känngård / [LotusScript] / 2003-01-14 / #59


The Execute function in LotusScript does not invoke the Initialize sub when "using" script libraries. I.e. if the library "libTEST" looks like:

(Options)
(Declarations)
Private session As NotesSession

Public Class Test
	Public Sub new()
		Print "session is nothing: " & (session is nothing)
	End Sub
End Class

Sub Initialize
	Set session = New NotesSession()
End Sub

...the code:

Dim s As String
s = |Use "libTEST"|
Execute(s)

...will not execute the Initilize code, and the session variable will be Nothing in the constructor, and will output:

session is nothing: True

I haven´t found any way around this bug yet.