By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,120 Members | 1,799 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,120 IT Pros & Developers. It's quick & easy.

Kang Su Gatlin: Linker Whitepaper question

P: n/a
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
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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 ka******@microsoft.com.

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

Thanks,

Kang Su Gatlin
Visual C++ Program Manager

--------------------
| From: "Steve Baer" <a-*****@mcneel.com>
| 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
|
|
|

Nov 17 '05 #2

P: n/a
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
"Kang Su Gatlin [MS]" <ka******@microsoft.com> wrote in message
news:YR*************@cpmsftngxa06.phx.gbl...
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 ka******@microsoft.com.

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

Thanks,

Kang Su Gatlin
Visual C++ Program Manager

--------------------
| From: "Steve Baer" <a-*****@mcneel.com>
| 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
|
|
|

Nov 17 '05 #3

P: n/a
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" <a-*****@mcneel.com>
| References: <O#**************@TK2MSFTNGP10.phx.gbl>
<YR*************@cpmsftngxa06.phx.gbl>
| 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
|
|
| "Kang Su Gatlin [MS]" <ka******@microsoft.com> wrote in message
| news:YR*************@cpmsftngxa06.phx.gbl...
| > 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 ka******@microsoft.com.
| >
| > I'll post an updated version of the note shortly.
| >
| > Thanks,
| >
| > Kang Su Gatlin
| > Visual C++ Program Manager
| >
| > --------------------
| > | From: "Steve Baer" <a-*****@mcneel.com>
| > | 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
| > |
| > |
| > |
| >
|
|
|

Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.