Kang Su Gatlin: Linker Whitepaper question

  • Thread starter Thread starter Steve Baer
  • Start date Start date
S

Steve Baer

I recently read your whitepaper under the "extremely long link times" post
and have a question that I was hoping you could answer.

My question is based on the following paragraph:
Directives
The linker's handling of directives left something to be desired in VC2003,
and for this reason code with lots of directives can suffer. In particular
__declspec(export), as it's likely the most common linker directive.
Besides that, don't export functions that you don't need to export.
Besides it becoming a code maintenance nightmare, it also increases your
link times.


Is there some other "better" way to handle DLL exports that makes the
"maintenance nightmare" more manageable?
Or do you just think that creating APIs is a bad idea?

Thanks for writing this article and I hope you can help clear up my
questions.
-Steve
 
Yes, I can see the confusion that can arise from that statement.
__declspec(export) in itself is not a bad thing. The code maintenance
problem has to do with exporting functions that you don't need to export,
as now you have exports that later developers added to the code base are
wondering "who else uses this??".

Let me rewrite the snippet and see if this is more clear:
"The linker's handling of directives left something to be desired in
VC2003, and for this reason code with lots of directives can suffer. In
particular __declspec(export), as it's likely the most common linker
directive. Given this, don't export functions that you don't need to
export. Exposing exports that are not necessary can be confusing to
developers working on the codebase, and it additionally increases your link
times. Of course creating exports for your APIs with __declspec(export)
is exactly what you should do. For VS2005 we do plan on fixing some of
these speed issues related to directives. I'll update this note when that
happens (although the recommendation to export only what you want to expose
stays intact regardless)."

I hope this makes things a bit more clear. If not, feel free to let me
know. Either on here or directly at (e-mail address removed).

I'll post an updated version of the note shortly.

Thanks,

Kang Su Gatlin
Visual C++ Program Manager

--------------------
| From: "Steve Baer" <[email protected]>
| Subject: Kang Su Gatlin: Linker Whitepaper question
| Date: Mon, 9 Aug 2004 23:36:43 -0700

|
| I recently read your whitepaper under the "extremely long link times" post
| and have a question that I was hoping you could answer.
|
| My question is based on the following paragraph:
| Directives
| The linker's handling of directives left something to be desired in
VC2003,
| and for this reason code with lots of directives can suffer. In
particular
| __declspec(export), as it's likely the most common linker directive.
| Besides that, don't export functions that you don't need to export.
| Besides it becoming a code maintenance nightmare, it also increases your
| link times.
|
|
| Is there some other "better" way to handle DLL exports that makes the
| "maintenance nightmare" more manageable?
| Or do you just think that creating APIs is a bad idea?
|
| Thanks for writing this article and I hope you can help clear up my
| questions.
| -Steve
|
|
|
 
Thanks for the quick reply and for helping me understand your point.

Our application exposes a large API for 3rd party developers to write
plug-ins, so we are stuck on this issue.

We've had some quirky issues with the incremental linker in the past, and
are trying to find ways to fix this. Our main issue is that the IL will work
just fine for a while and all of a sudden completely fail. This forces us to
do a full rebuild. I don't have the error code on me, but I will pass along
the word to everyone in the company to write down the error message when the
IL fails.

Thanks again,
-Steve Baer
Robert McNeel & Associates
 
Adding /TEST to the linker switch might be useful, so when you do see this
quirky IL behavior it may give you a hint, or you can mail it to us and see
what we can derive from it. We may need to request a link repro though to
get to the bottom of it.

Thanks,

Kang Su Gatlin
Visual C++ Program Manager

--------------------
| From: "Steve Baer" <[email protected]>
| References: <O#[email protected]>
<[email protected]>
| Subject: Re: Kang Su Gatlin: Linker Whitepaper question
| Date: Tue, 10 Aug 2004 09:05:12 -0700

|
| Thanks for the quick reply and for helping me understand your point.
|
| Our application exposes a large API for 3rd party developers to write
| plug-ins, so we are stuck on this issue.
|
| We've had some quirky issues with the incremental linker in the past, and
| are trying to find ways to fix this. Our main issue is that the IL will
work
| just fine for a while and all of a sudden completely fail. This forces us
to
| do a full rebuild. I don't have the error code on me, but I will pass
along
| the word to everyone in the company to write down the error message when
the
| IL fails.
|
| Thanks again,
| -Steve Baer
| Robert McNeel & Associates
|
|
| | > Yes, I can see the confusion that can arise from that statement.
| > __declspec(export) in itself is not a bad thing. The code maintenance
| > problem has to do with exporting functions that you don't need to
export,
| > as now you have exports that later developers added to the code base are
| > wondering "who else uses this??".
| >
| > Let me rewrite the snippet and see if this is more clear:
| > "The linker's handling of directives left something to be desired in
| > VC2003, and for this reason code with lots of directives can suffer. In
| > particular __declspec(export), as it's likely the most common linker
| > directive. Given this, don't export functions that you don't need to
| > export. Exposing exports that are not necessary can be confusing to
| > developers working on the codebase, and it additionally increases your
| link
| > times. Of course creating exports for your APIs with
__declspec(export)
| > is exactly what you should do. For VS2005 we do plan on fixing some of
| > these speed issues related to directives. I'll update this note when
that
| > happens (although the recommendation to export only what you want to
| expose
| > stays intact regardless)."
| >
| > I hope this makes things a bit more clear. If not, feel free to let me
| > know. Either on here or directly at (e-mail address removed).
| >
| > I'll post an updated version of the note shortly.
| >
| > Thanks,
| >
| > Kang Su Gatlin
| > Visual C++ Program Manager
| >
| > --------------------
| > | From: "Steve Baer" <[email protected]>
| > | Subject: Kang Su Gatlin: Linker Whitepaper question
| > | Date: Mon, 9 Aug 2004 23:36:43 -0700
| >
| > |
| > | I recently read your whitepaper under the "extremely long link times"
| post
| > | and have a question that I was hoping you could answer.
| > |
| > | My question is based on the following paragraph:
| > | Directives
| > | The linker's handling of directives left something to be desired in
| > VC2003,
| > | and for this reason code with lots of directives can suffer. In
| > particular
| > | __declspec(export), as it's likely the most common linker directive.
| > | Besides that, don't export functions that you don't need to export.
| > | Besides it becoming a code maintenance nightmare, it also increases
your
| > | link times.
| > |
| > |
| > | Is there some other "better" way to handle DLL exports that makes the
| > | "maintenance nightmare" more manageable?
| > | Or do you just think that creating APIs is a bad idea?
| > |
| > | Thanks for writing this article and I hope you can help clear up my
| > | questions.
| > | -Steve
| > |
| > |
| > |
| >
|
|
|
 
Back
Top