Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB COM compiling Issue

Posted on 2000-05-11
11
Medium Priority
?
254 Views
Last Modified: 2013-11-25
Why in earth do you have to compile a VB dll twice? And why the first compile is always no compatibility?
0
Comment
Question by:gnagabandi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 2

Expert Comment

by:Crin
ID: 2802362
Sorry, could you describe your problem in some more words?

As I understood, you mean that every compilation changes CLASSID for objects provided by your DLL, right?

Sincerely yours,

Crin
0
 

Author Comment

by:gnagabandi
ID: 2802379
Hi Crin,

You are right. But my question is Why we need to first compile with no compatability. What is the logic behind that?

Thanks,
Gang.
0
 
LVL 2

Expert Comment

by:Crin
ID: 2802477
I created a number of ActiveX dlls and EXEs and always used 'Project compatibility' option... Never had problems VB restrict me to select this option, do you have?

I'm sorry, english is not my native language... please describe your situation and why you compile your dll twice?

Sincerely yours,

Crin

0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 15

Expert Comment

by:ameba
ID: 2802552
You don't have to compile twice. Compile ones. After that, set compatibility OF YOUR PROJECT to whatever you want.

Related links:
http://www.vb2themax.com/Item.asp?PageID=TipBank&ID=290
http://www.comdeveloper.com/articles/binarycomp.asp
0
 
LVL 2

Expert Comment

by:corvanderlinden
ID: 2803461
You have to compile twice.

The first time you compile set 'No compatiblity', compile and copy your DLL to a directory like for instance CompDlls
Then set Project Compatibility or Binary Compatability and reference your first compiled DLL in CompDlls. Then compile and make sure your new DLL is NOT in CompDlls. Then compile again and again .......

This has to do with VB not cluttering up your registry with GUID's, UUID's etc. every time you compile
There is a good article on the subject in MSDN:
Building, Versioning, and Maintaining Visual Basic Components

0
 
LVL 3

Expert Comment

by:Gordonp
ID: 2803514
corvanderlinden,

You only need to compile your Dll once to use it.

Only if you want to recompile your dll at a later stage (ie after an update) do you need to make the copy and set the compatability.

Gordon

0
 
LVL 3

Expert Comment

by:Gordonp
ID: 2803545
And your first ever compile has to be with no compatability because there nothing for it to be compatable with.
0
 
LVL 2

Expert Comment

by:Crin
ID: 2803854
gnagabandi,

Seems Gordonp phrases describes your problem very well. The only thing if compiler prohibit you to set 'Compatibility' option while first compiling. In fact sentence "And your first ever compile has to be with no compatability because there nothing for it to be compatable with." is the answer, I suppose :))

Sincerely yours,

Crin

0
 
LVL 2

Accepted Solution

by:
corvanderlinden earned 200 total points
ID: 2804061
GordonP
You are correct, and so am I. Read my original message's second line

Further you are right that you only have to follow my procedure the second time you compile but I make it a habit to follow this procedure alos on the first compile because it is my experience that you on a second compile often forget to first copy the original DLL (or ActiveX.EXE) and forget the Compatibility settings

Cor

0
 

Author Comment

by:gnagabandi
ID: 2809332
corvanderlinden,

I always follow your method only. But my question is why can't we create Binary Compatable Dll first time itself (I mean without No compatable).
0
 
LVL 2

Expert Comment

by:corvanderlinden
ID: 2809585
Binary Compatability cannot be set the first time because you first have to have a DLL to be compatable with. Binary Comp. means that the compiler checks the interfaces of the new DLL against the interfaces of the 'old' DLL (the one you specify in the components tab of Project properties).
If the interfaces change compatiblity is broken and the compiler has to assign new GUID's etc.
In a way the first DLL you compile (with No Comp.) is a blueprint for every new compile of your DLL.
(it is hard to describe in a few words but I hope this clarifies it a little)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question