-
DLL doesn't see itself?!
Hrm, I'm making a really silly mistake. I've got a DLL that has several class modules. Each one contains various subs. However, one module can't seem to see another's subs, even though they're public.
My .exe project CAN see them. But the DLL can't seem to see other subs in other class modules.
Anyone care to enlighten the Newbie? :rolleyes:
-
Did you declare an instance of the other class inside the class you want are accessing it from?
All the code in the class modules still only appear when you make an object from them even within the same project. If you want to share things between them you may want to try using a standard module in the dll project.
-
Hmm, let me get this straight...
I've got a class module named 'communication' with several subs.
If I want to use those subs in another class module, I have to reference 'communication'?
But, instead, I could just put all my subs into a normal module, and my problems are over?
Sigh. Thanks, Edneeis. I knew it was something silly.
-
Although keep in mind that any subs in a standard module can't be accessed from an exe that references the dll. You can either make internal version of the subs in a standard module or you can pass in an instance of the other class to any functions that need it. So say the server class gets passed a communication object for a function in order to change things in it. If you use the standard module then you have to also have a way of identifying which instance you are trying to work with so that solution is not as easy as it sounds either. It depends a lot on what you are trying to do.
-
Hmm, I spoke too soon...
Okay, I've got most of my subs moved into the right places. However, there's a sub (ClientMsg) I'd like to access both in my .exe and in my DLL. So, I keep it in the class mod, right?
How do I reference it in another module? I keep trying something like:
Public Msg as ClientMsg
But that doesn't seem to work correctly. It appears I'm lacking in basic instancing understanding.
-
IF you want to refrence another class you have to use the same syntax you would use if you were refrensing it from outside the DLL.
You have 2 classes inside the same DLL CLASS1 and CLASS2
CLASS1 wants to call a method from CLASS2.
Insode CLASS1 you have to say
DIM MYobj as NEW CLASS2
Then use MYobj however you want.
-
Thanks, Arc. I guess I was making it a lot more difficult than it really was. Somehow, I thought it had to be hard. :)
-