| The problem is this. Many of the classes use other classes, and there are
| also some globally defined objects that would need to be accessible to both
| the EXE and the DLL.

Signature
Joanna Carter [TeamB]
Consultant Software Engineer
Hi Joanna,
I realize that, but what about an Object based on that class. If the object
is declared (globally) in the EXE, would it be accessible to classes declared
in the DLLs ?
ie.
EXE has Public SysSettings as new clSysSettings
if the class in a DLL has this
Public Class clItem
Public Sub LoadItem(ItemID as GUID)
Private SQLcmd As SQLCommand=New SQLCommand ("<some
SQL>",SysSettings.cnSQL)
End Sub
End Class
Would this work, ie would the SysSettings object be accessible to the Class
when teh Class resides in a different assembly to where SysSettings is
declared.
Petri
> | The problem is this. Many of the classes use other classes, and there are
> | also some globally defined objects that would need to be accessible to
[quoted text clipped - 5 lines]
>
> Joanna
Jesse Houwing - 16 Jun 2006 12:03 GMT
> Hi Joanna,
>
[quoted text clipped - 17 lines]
> when teh Class resides in a different assembly to where SysSettings is
> declared.
No this won't work. You'll have to move the global declaration to the
classlibrary aswell. Then it can be shared by the executable.
Jesse
> Petri
>
[quoted text clipped - 7 lines]
>>
>> Joanna
Petri - 16 Jun 2006 13:00 GMT
Thanks for the info
Can you do a global declaration in a DLL (scope would be DLL only) as well ?
I wouldn't want to go through all the classes to do it if I don't have to
(allthough that would be wise probably)
> > Hi Joanna,
> >
[quoted text clipped - 34 lines]
> >>
> >> Joanna
Joanna Carter [TeamB] - 16 Jun 2006 12:59 GMT
| I realize that, but what about an Object based on that class. If the object
| is declared (globally) in the EXE, would it be accessible to classes declared
| in the DLLs ?
You can't declare a "global" object without it being a static member of a
class.
Any public static member of any public class can be seen in any other
assembly that references the declaring assembly.
//assembly1
namespace My.Name.Space
{
public static class MyGlobals
{
private static MyType myField = new MyType();
public static MyType MyProperty
{
get { return myField; }
set { myField = value; }
}
}
}
//assembly2 - references assembly1
namespace My.Application
{
using My.Name.Space;
public class SomeClass
{
public void Test()
{
MyType instance = MyGlobals.MyProperty;
...
}
}
}
Joanna

Signature
Joanna Carter [TeamB]
Consultant Software Engineer