|
-
Apr 21st, 2003, 02:29 PM
#1
Thread Starter
Member
Switching DLLS at execution/runtime
Hello,
I was wondering if anyone knows how to do this? What I have is 2 versions of my dll (program.dll and program2.dll). Now what I want is to have them on a switch of some sort so that I (and my testing users) can run my program with the new code and have users execute the old one until I am ready to release to the masses. I can't use the #IF #ELSE #END IF statements because these are at compile time and I can't break all my other users. My compile directory is open and users can download updates anytime, so I can't leave a copy on there where they can get it.Besides it takes me at least 1/2 an hour (doing this twice does not appeal to me)
Now if I have to I can use a command line argument when the program is loaded, but I would prefer for it do be in an ini file on a switch.
Anyone with any ideas on how to do this?
Ryan007
-
Apr 21st, 2003, 03:44 PM
#2
Addicted Member
late bind to your classes using CreateObject() ?
Free Code, papers, tools, and more
http://sandsprite.com
-
Apr 21st, 2003, 04:58 PM
#3
Thread Starter
Member
Good Idea!!! 
I will try that.
Ryan
-
Apr 22nd, 2003, 11:06 AM
#4
Thread Starter
Member
Okay that worked! Calling the createobject method works slick.
Now I have an issue of my dlls. Which ever one I last registered is the one used. It turns out they are using the same clsid. Does anyone know how to change it so that they use different clsids? How would I go about changing it?
Thanks
Ryan
-
Apr 22nd, 2003, 11:19 AM
#5
Frenzied Member
You probably have binary compatibility set in your project's options. Try using "Project Compatibility" instead.
-
Apr 22nd, 2003, 11:22 AM
#6
Thread Starter
Member
It is set to project compatability.
What about the DLL Base address option? What is this and should I be messing with it?
Ryan
-
Apr 22nd, 2003, 11:28 AM
#7
Frenzied Member
Actually "Project Compatibility" will not produce a new CLSID so you'd have to have "No Compatibility" set and hope you don't screw things up.
See this article to see why you should change your base address, although it doesn't have anything to do with your problem.
-
Apr 22nd, 2003, 11:35 AM
#8
Thread Starter
Member
When I fire up My Resource Tuner, and load my dll. I see a line in there under the TypeLib header that says:
GUID = {GUID}
Now this is what I have to modify. I can actually go in and change this, but i want it to be changed in my code so I don't have to change it everytime I recompile.
Anyone know how to do this?
Ryan
-
Apr 22nd, 2003, 11:43 AM
#9
Frenzied Member
Set your project to "No Compatibility."
-
Apr 22nd, 2003, 11:47 AM
#10
Thread Starter
Member
Okay, that worked.
Do you know why I would have to set it to "No Compatiblity"? I have both of my projects set to project compatiblity and they are both referencing their own dlls?
Ryan
-
Apr 22nd, 2003, 11:56 AM
#11
Addicted Member
yeah just set the new dll to no compat for the first compile, that will give it all new GUIDs then you can either leave it there or set it to project compat again
( i think leaving it as no compat just keeps adding junk to your registry every compile as the old info gets orphaned and is never deleted)
dont worry about base address, that wont have an effect on this, what your experiences comes from the registry pointing at the last compiled dll file on disk from its path info.
what dll tuner are you using?
its usally not worth the effort on somethign like this because you have to change the library GUID the class GUID etc.
I one i use from powervb.com will let you edit stuff, but then you can only save it as an external .tlb file so then you have to go with a resource editor and replace the tlb in teh dll with the new one then it never works and I have to recompile to get a good dll again
(although I suppose I should probably actaully read the docs though to make sure I am using it as the author planned \
Free Code, papers, tools, and more
http://sandsprite.com
-
Apr 22nd, 2003, 12:11 PM
#12
Thread Starter
Member
Lizzy,
Thats what I figured it out. Having to set the project to no compatibility for the first compile. After that set it to project reference and everything is fine.
The dll viewer that I was using was called "Resource Tuner". It turns out that I couldn't edit the dll directly (although someone told me that I could).
Once I figured out that I had to set the project to no compatibility for the first compile and reset it back later. The guy that usually compiles my programs is now gone, and I was thrown into his place. So compiling was new to me.
Thanks for everyone's help. It was really appreciated!!
Ryan
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
|