Error using VB6 Custom DLLs when creating references

I have created two VB6 SP6 custom DLLs. BOTH DLLS reference two classes, cPoint and cPoints.

In the code below, Calling Sub CreateShell, the oPoints1 and oPoint objects function correctly and are instantiated against ShellPoints1 classes with the new oPoint = {0,0,0}, then changing to the new values later works too.

In the watch window, oDP("p1").pt3D have values as set in the previous SUB while oPoint = nothing in the watch, but should = {0,0,0} after being instantiated. No error on the instantiation, just during the set = line.

That said ... can a single project reference two different DLLs that have the same class names? IF NOT, where could I find information regarding how to use DLLs properly? Google and the EE search were fairly useless researching this.

Yes, you can reference two DLLs that contain matching class names. By including the Project Name with the class name (as you are doing) will keep the classes distinct. When your DLLs contain distinct class names, you do not have to include the DLLs project name to access the class.

As for Automation Error, that occurs when you either attempt to access a class or class member that is not public, or does not exist. It can also occur if you recompile your DLLs without maintaining Binary Compatability.

When you reference a VB DLL, you don't REALLY access it by project name, you access it by GUID. When you have binary compatibility turned on, each time you rebuild the DLL, the GUID will remain the same, and the project that references the DLL will still find it. But if you break binary compatability by changing the interface of the DLL, or simply don't have binary compatability turned on in the "Component" tab of the DLLs project properties, you will create a new GUID for the DLL, losing the previous GUID the other project references.

So from what I can make out from your code sample and statements, it looks like ShellPoints2 DLL is either incorrectly referenced (i.e. can't find its GUID), or the instance you are referencing does not have a "pt3D" member for its cPoint class... or oDP("p1").pt3D is not valid for ShellPoints1 DLL.

The Binary Compatibility was an issue however, I had further problems, so I have just reverted to having multiple instances of a single custom dll, which the AutoCAD VBA 5 seeme to appreciate better, the code also processes nearly 100% faster using the singular DLL.

To extend HooKooDooKu explanation:
While I actually had binary compatability so to speak when I compiled in the VB6 IDE, I didn't while referencing in the VBA IDE. Both projects were referencing the same dll name, not each projects dll name:

Featured Post

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.