Click to See Complete Forum and Search --> : Act-Dll Compilation Problem


Ravi Kiran
October 7th, 1999, 09:26 PM
Hi All,

I am recently encountering this problem. I have a portion of my program running as active-x dll.
I wrote this, tested it and compiled to dll. Every thing worked fine, and my other prorgams (clients) were able to access it.

Now i have added new code to it. I Checked the binary compatabilty option ON, and selected the dll name. Added a whole new Class. No problems with OLE interface (because VB did not crib!). During developmet, put the dll in run mode, and in the client progam select the .VBP project as reference, and i was able to access the new class and functionality.

Now comes the problem: When i want to compile this dll with same old name, but version changed, VB is cribing that "Error while compiling" and it generates the Linker Error that says "Error while opening the file ..xxx.dll"

I tried all sorts of stuff, i can think of.
Only thing that works - A NO GOOD solutn- unregister the server (dll) from Dos window, using regsvr32 /u, then delete the dll file. Reopen VB and it will crib that "dll (for Binary compatability) not found" and recompile, in which case it will generate new ClSID etc.
The question is :
How to re-compile a Active-x dll in VB, which was compiled once before and is active? The new version is written w/o affecting the existing interface, only new fns are added?

VB Ver:5.0

Thanks for any help.. please..

Ravi Kiran


RK

Bruno
October 7th, 1999, 10:17 PM
You can check this article:
http://www.comdeveloper.com/articles/binarycomp.asp

I am not sure if it will be useful to you, because it is for VB6;
The "Preserve Compatibility" option is new to VB6, and was not in previous versions of the environment.

Ravi Kiran
October 8th, 1999, 06:43 AM
Hi,
Thanks for the link. It was good. I read it fully and was useful to refresh some, adn quite a bit of it was what i knew..

But unfortunately, it still doesn't answer why 'Unable to open file error' by the linker?!, when i (re)compile the project. By the way, VB also uses the same VC linker. so the error nos are same.



RK

Crazy D @ Work
October 8th, 1999, 07:14 AM
Not sure if it helps, but if I switch from my project to my control and try to recompile it, it can't. I have to start a new project, then select the control project and then it can compile.
Seems like VB doesn't 'free' the control. Maybe it's the case with your dll too.
Hth

Crazy D @ Work :-)

Bruno
October 8th, 1999, 01:10 PM
I reproduced the behaviour you described.
Second VB-IDE (with Client program) did not free the DLL.
To free memory before compiling new version of DLL, you can:
- close this second VB (and reopen it later)
- uncheck reference to the DLL (and check it later)

>unregister the server (dll) from Dos window, using regsvr32 /u, then delete the dll file
Your solution seems easier (batch file, one dbl_click) than closing/opening VB. Maybe it can work if you:
Copy your DLL to a separate directory and rename it to .CMP
Use .CMP file in your setting: Component, Binary Compatibility filename (i.e. do not use your DLL directly)

Ravi Kiran
October 9th, 1999, 12:47 AM
Hi,
>I reproduced the behaviour you described.
>Second VB-IDE (with Client program) did not free the DLL.
>To free memory before compiling new version of DLL, you can:
>- close this second VB (and reopen it later)
>- uncheck reference to the DLL (and check it later)


This was the First thing i tried!. Like I said, i tried all that i can think off. I even removed the 'Reference' to the dll Class in the client project, saved it and closed that instance of VB.
But still it wouldn't work, when i compile the dll.

This first version of the dll, was made quite some time back, abt a month. And after that i am finding the need to add the 2nd class to it. I can make another dll for the second class, but then much is common between them, it would really be funny to do that.

Infact i have been trying since two days. so i guess i would have tried all possible combinations!

On NT, if wont even allow me to delete the dll from Explorer - May be there is something in this hint? But the "Properties" menu on right click shows no 'read-only' ,. so.. i am foxed?!?


Abt this Binary compatabilty.. i am foxed again.. because VB doesn't complain that the new version is not compatible with the old one. [ - Which it does, when you change return type or param type etc ]. Infact i haven't changed anything of the old class, so no reason why VB should complain in the first place!

Anyway, thanks for your time and for trying.

RK