-
Aug 4th, 2022, 01:53 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] ActiveX dll's that reference each other
Is this possible?
EDIT
This is related to the discussion on assume no aliasing. I have a customized version of cHashD that is strongly typed for a string key and a class type.
So I made a sep dll for the chashHD but of course it need to reference that other dll with the class type in it and the other dll needs to ref the dll with clsHashD in it. Getting tied up in knots here.
Don't think this is possible...
Last edited by vbwins; Aug 4th, 2022 at 01:59 AM.
-
Aug 4th, 2022, 04:13 AM
#2
Re: ActiveX dll's that reference each other
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Aug 4th, 2022, 05:21 AM
#3
Thread Starter
Hyperactive Member
Re: ActiveX dll's that reference each other
Originally Posted by Zvoni
Use latebinding?
But then I need to pass to classes as variant and I loose the strongly typed performance opt as stuff has to be coerced to variant.
-
Aug 4th, 2022, 05:38 AM
#4
Re: ActiveX dll's that reference each other
hmm....what about swapping out that "type" into a support-Ax-DLL, so both dll's can reference that type in that dll, and the second dll then only needs to reference the first one?
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Aug 4th, 2022, 05:40 AM
#5
Re: ActiveX dll's that reference each other
So you now have project A with some custom VB6 classes and project B with cHashD and need B to reference A for the cHashD to return items of A class types but then you need A to reference B for A want to use cHashD instances. This dependency graph looks like this
You can try transforming it to this
So cHashD sees all the types from A and can return items of A class types while A does not reference B but a separate *type library* C which has an interface which cHashD implements which could be even default _cHashD interface redeclared or it could be a specialized IHashD interface which cHashD explicitly implements.
cheers,
</wqw>
-
Aug 4th, 2022, 05:41 AM
#6
Re: ActiveX dll's that reference each other
Originally Posted by wqweto
So you now have project A with some custom VB6 classes and project B with cHashD and need B to reference A for the cHashD to return items of A class types but then you need A to reference B for A want to use cHashD instances. This dependency graph looks like this
You can try transforming it to this
So cHashD sees all the types from A and can return items of A class types while A does not reference B but a separate *type library* C which has an interface which cHashD implements which could be even default _cHashD interface redeclared or it could be a specialized IHashD interface which cHashD explicitly implements.
cheers,
</wqw>
Eh? So i was actually pretty close.....
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Aug 4th, 2022, 06:21 AM
#7
Re: ActiveX dll's that reference each other
Originally Posted by Zvoni
Eh? So i was actually pretty close.....
No, you got it all reversed while I was posting my reply :-))
You keep A-->B but then make a new B-->C which might be way to much effort -- C now has to have all the class types from A which can be hundreds of different business objects which OP keeps in collections.
If it wasn't tricky I wouldn't have bothered to post in first place :-))
cheers,
</wqw>
-
Aug 4th, 2022, 06:36 AM
#8
Re: ActiveX dll's that reference each other
Originally Posted by wqweto
No, you got it all reversed while I was posting my reply :-))
cheers,
</wqw>
For me, THAT is close.... :-)
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Aug 4th, 2022, 06:38 AM
#9
Re: ActiveX dll's that reference each other
Originally Posted by vbwins
Is this possible?
EDIT
This is related to the discussion on assume no aliasing. I have a customized version of cHashD that is strongly typed for a string key and a class type.
So I made a sep dll for the chashHD but of course it need to reference that other dll with the class type in it and the other dll needs to ref the dll with clsHashD in it. Getting tied up in knots here.
Don't think this is possible...
I never did but I don't see a problem. Did you try?
-
Aug 4th, 2022, 07:53 AM
#10
Thread Starter
Hyperactive Member
Re: ActiveX dll's that reference each other
Originally Posted by Eduardo-
I never did but I don't see a problem. Did you try?
Yes I tried. Failed. And I suspect that it gets properly impossible when you want to change the interface of one of the DLL's
I think then you will be in a situation where you cant compile one without compiling the other.
-
Aug 4th, 2022, 08:02 AM
#11
Re: ActiveX dll's that reference each other
Originally Posted by vbwins
Yes I tried. Failed. And I suspect that it gets properly impossible when you want to change the interface of one of the DLL's
I think then you will be in a situation where you cant compile one without compiling the other.
Ah, it fails to compile when the two projects are opened in a group. But compiled individually they should work, I guess.
-
Aug 4th, 2022, 08:11 AM
#12
Re: ActiveX dll's that reference each other
Originally Posted by Eduardo-
Ah, it fails to compile when the two projects are opened in a group. But compiled individually they should work, I guess.
How if it cannot solve the dependency because the other dll is (still) not compiled?
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Aug 4th, 2022, 08:17 AM
#13
Re: ActiveX dll's that reference each other
Compile both first, without a reference to the other (so lacking some of the properties/methods)
Then you can add a reference from A->B
And you can add a reference from B->A
-
Aug 4th, 2022, 08:38 AM
#14
Re: ActiveX dll's that reference each other
Originally Posted by Arnoutdv
Compile both first, without a reference to the other (so lacking some of the properties/methods)
Then you can add a reference from A->B
And you can add a reference from B->A
Exactly. That was the idea. To compile a first version without the dependency. And then, try to add the dependency and compile one at a time.
But anyway I don't like this idea. I would try to avoid doing this cross dependency.
-
Aug 4th, 2022, 08:46 AM
#15
Re: ActiveX dll's that reference each other
Originally Posted by Arnoutdv
Compile both first, without a reference to the other (so lacking some of the properties/methods)
Then you can add a reference from A->B
And you can add a reference from B->A
How if he needs a Type provided by the "other" DLL?
Or do you mean as a "dummy" (a.k.a. empty dll)?
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Aug 4th, 2022, 08:52 AM
#16
Re: ActiveX dll's that reference each other
Yes indeed, start with a barebone interface.
When you have the references you can add new interfaces without problems
But I would use 3 ActiveX dlls.
One main DLL for the shared types etc. And probably for some shared other interfaces.
Then the 2 other DLLs for their specific needs.
-
Aug 4th, 2022, 09:15 AM
#17
Re: ActiveX dll's that reference each other
Originally Posted by Zvoni
How if he needs a Type provided by the "other" DLL?
Or do you mean as a "dummy" (a.k.a. empty dll)?
You compile the first DLL that is not depending on the still not compiled (or existent) second DLL.
Then compile the second DLL with dependency to the first.
Then add the dependency on the first DLL to the second and compile it again, now with the dependency to the second.
-
Aug 4th, 2022, 09:32 AM
#18
Re: ActiveX dll's that reference each other
Circular dependencies! Welcome to Hell :-)
It is wonderful experience when you clone source of A and B and there are missing those initial simple binary dependencies) and current version of sources does not allow to create them easily.
"Wait, I will copy it from MY MACHINE so you can compile" - everyone who worked in team have heard something similar for some buggy projects that someone in the team created with the mind of great excellence and "advanced code" of using only two libraries and not add third one.
When you work alone and you can "remember" that you did this or that, source control is something bad and not compatible with your "working style", then doing all these actions may seem possible. But time passes, memory fades, computers are changed, binary folders are cleaned because of some other projects did not compile and BOOM - our A and B projects also fail to compile after the cleanup! Here they come - cyclic references FTW!
Someone may put the initial small binaries in a folder, keep them in the source control, but the build cycle to reach successful compilation of the current version is still tricky without the right tooling and build scripts.
Note: some other languages were created with the mind of circular dependencies and all that is handled by the compiler and other tooling. But they have that feature by design and some coding patterns are built upon this design.
-
Aug 4th, 2022, 09:53 AM
#19
Re: ActiveX dll's that reference each other
Personally, I think Zvoni had the correct answer, late binding. However, this does require a bit of hoop-jumping, but I've been doing it for years in my main project (used daily in many locations).
Here's a link to the code I use to instantiate a class from an unregistered ActiveX DLL.
You just have to remember to call UnloadActivexDll when you're done, or the library will stay in memory. Example is shown in the link.
Using this approach, you can have all the circular ActiveX DLL references you want, because it's not dependent on anything being registered.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Aug 4th, 2022, 10:05 AM
#20
Re: ActiveX dll's that reference each other
Late-bindings undermines the very purpose because he used that class due to the performance advantage of strong-typing.
Originally Posted by peterst
Circular dependencies! Welcome to Hell :-)
Yes, not a good idea at all, but possible, it is possible.
-
Aug 4th, 2022, 10:14 AM
#21
Re: ActiveX dll's that reference each other
Originally Posted by Eduardo-
Late-bindings undermines the very purpose because he used that class due to the performance advantage of strong-typing.
I thought he used that class (i.e., DLL) to get the performance advantages of optimization flags. You still get that with late binding. I use late binding with my smoothing algorithm, and it works absolutely fine, still giving me the performance boost. Admittedly though, I'm not calling the DLL's class's members in a loop though.
Code:
' Code at top of module:
Dim oContour As Object ' Separate DLL to make image colorful.
' Code in Form_Load (loading "optimized" ActiveX DLL):
Set oContour = NewObjectFromActivexDll(DependenciesFolder & "Contour.dll", "clsContour")
' Code in specific processing spot to do the work. Both bbEnlarged and bbFrame are byte arrays of the image.
oContour.bbDoContouring bbEnlarged, bbFrame
' Code in Form_Unload:
Set oContour = Nothing
UnloadActivexDll DependenciesFolder & "Contour.dll"
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Aug 4th, 2022, 10:30 AM
#22
Re: ActiveX dll's that reference each other
Originally Posted by Elroy
I thought he used that class (i.e., DLL) to get the performance advantages of optimization flags. You still get that with late binding. I use late binding with my smoothing algorithm, and it works absolutely fine, still giving me the performance boost.
With late-binding you lose performance.
-
Aug 4th, 2022, 10:32 AM
#23
Re: ActiveX dll's that reference each other
Originally Posted by Eduardo-
With late-binding you lose performance.
Only on the actual call to get into whatever member you're calling. If we're not in a loop making calls into the DLL, that's negligible. The compiler optimizations will be the same either way (early or late bound).
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Aug 6th, 2022, 03:00 AM
#24
Re: ActiveX dll's that reference each other
Isn't the obvious solution, to put both Classes into the same Dll-Project?
Olaf
-
Aug 10th, 2022, 01:15 AM
#25
Thread Starter
Hyperactive Member
Re: ActiveX dll's that reference each other
Originally Posted by Schmidt
Isn't the obvious solution, to put both Classes into the same Dll-Project?
Olaf
One class (A derivative of chashd) needs to be compiled without assume no aliasing
-
Aug 10th, 2022, 02:43 AM
#26
Re: ActiveX dll's that reference each other
Originally Posted by vbwins
One class (A derivative of chashd) needs to be compiled without assume no aliasing
And the other one cannot be compiled with exactly the same compiler-settings because...?
I mean, the whole RC6.dll (with 100+ Classes) is compiled this way
(all extra-compiler-Flags on, only the "top-one" off).
Olaf
-
Aug 11th, 2022, 05:22 AM
#27
Thread Starter
Hyperactive Member
Re: ActiveX dll's that reference each other
And the other one cannot be compiled with exactly the same compiler-settings because...?
That's where I ended up anyway.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|