J
JB
Hi All,
I'm building a DLL that can be used by several applications.
I'd like to have one single instance of a Class stored in my DLL that
would be ("shared") by all the applications using that DLL.
I've tried to declare in my DLL a Class with a single "Shared" member,
but each time I reference the DLL from another application, a new
instance is created.
For instance:
'My shared Class (in the DLL)
Public Class CSharedKernel
Public Shared MainKernel As New CKernel
End Class
'The content of the shared class (in the DLL)
Public Class CKernel
Public m_KernelString As String = ""
Sub New()
m_KernelString = "Kernel Object created at " &
Now.ToString("HH:mm:ss")
End Sub
End Class
'When I call the following in 2 separate applications using the DLL
'I get 2 different times telling me it's actually 2 different
'instances of CKernel
MsgBox(CSharedKernel.MainKernel.m_KernelString")
Is this possible to achieve at all in a DLL?
Thanks a lot
I'm building a DLL that can be used by several applications.
I'd like to have one single instance of a Class stored in my DLL that
would be ("shared") by all the applications using that DLL.
I've tried to declare in my DLL a Class with a single "Shared" member,
but each time I reference the DLL from another application, a new
instance is created.
For instance:
'My shared Class (in the DLL)
Public Class CSharedKernel
Public Shared MainKernel As New CKernel
End Class
'The content of the shared class (in the DLL)
Public Class CKernel
Public m_KernelString As String = ""
Sub New()
m_KernelString = "Kernel Object created at " &
Now.ToString("HH:mm:ss")
End Sub
End Class
'When I call the following in 2 separate applications using the DLL
'I get 2 different times telling me it's actually 2 different
'instances of CKernel
MsgBox(CSharedKernel.MainKernel.m_KernelString")
Is this possible to achieve at all in a DLL?
Thanks a lot