« Converting TDateTimes to System.DateTimes and backThe Burger Of Eternal Fullness »

E2328 Linker error while emitting metadata


  11:41:25 am, by Nimble   , 185 words  
Categories: Programming

E2328 Linker error while emitting metadata

There are few things more fun than topping off a righteously sweaty code refactoring session with a particularly rare and un-to-underdocumented linker error.

I ran into this in CodeGear RAD Studio 2007 on the Delphi for .NET side. It was different than the small handful of problems I saw other people run into, and since I managed to track it down to a particular line, I thought I would share it.

My encounter with this linker error happened when using a named constant set, e.g.

FIELD_BLOB_TYPES : set of MyFieldType = [mftBinary, mftGraphic, mftDiagram, mftAttachments]

The code that caused the explosion simply used the type:

if Attribute.ValueType in FIELD_BLOB_TYPES then

Replacing it with the full set fixed the issue:

if Attribute.ValueType in [mftBinary, mftGraphic, mftDiagram, mftAttachments] then

Note that using this code construct is no guarantee that this linker issue will happen - I actually use this construct in other parts of my code with no problem - but if you do run into this weird linker error, this may be the straw that is breaking the camel's back.

Hopefully, I can save someone out there from the frustration.

1 comment

Comment from: Ritchie Annand [Visitor]
Ritchie Annand

One other way it can happen is when something is holding onto the existing .pdb file.

Today, it occurred because I was running AQTime elsewhere, but the project still was set to look up debug information in my output folder. I thought it would just read the files; I did not think it would hold onto them.

So, try to delete your .pdb files if you get this error, especially if it suddenly starts happening when it never has before.

02/02/12 @ 12:27