Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8384623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:26:59+00:00 2026-06-09T17:26:59+00:00

Now I analyse some old code, which was not written by me. In headers

  • 0

Now I analyse some old code, which was not written by me. In headers there are many declarations like this:

SVPDSDKDLLEXPORT inline C3vec mult(C3vec src, D3DXMATRIX &m);

SVPDSDKDLLEXPORT is defined as _declspec(dllexport), if it is used in SVPDSDK; as _declspec(dllimport), if it is used in any project, which uses SVPDSDK.dll. Inlining here seems very strange for me as there is no definition in the header, it is in .cpp file, but compilation and linkage of SVPDSDK and all projects, which use respective DLL, are executed without any problems. I assume, that it is just ignored and the function is exported as though is was not inlined.

I’ve found this discussion:
C++ : inline functions with dllimport/dllexport?

Looked like I should have removed “inline” from all such declarations, don’t mix inlining and export/import. But then I found this topic in MSDN:
http://msdn.microsoft.com/en-us/library/xa0d9ste

I don’t understand some parts of it.

You can define as inline a function with the dllexport attribute. In this case, the function is always instantiated and exported, whether or not any module in the program references the function. The function is presumed to be imported by another program.

Firstly, “the function is always instantiated”, what does it mean? I’ve found only topics about template functions instantiation in C++, no any other instantiation. Is it connected only with templates or not?

Secondly, “the function is always exported”. I don’t understand it at all. Is it possible, that function with declspec(_dllexport) is not exported in some cases? In what cases?

Now about import:

You can also define as inline a function declared with the dllimport attribute. In this case, the function can be expanded (subject to /Ob specifications), but never instantiated. In particular, if the address of an inline imported function is taken, the address of the function residing in the DLL is returned. This behavior is the same as taking the address of a non-inline imported function.

Again, I don’t understand, what means instantiation in this case.

While writing this question and analysing topic from MSDN, I made a conclusion, that function, which is exported/imported and inlined at the same time, is inlined only in its project itself (SVPDSDK in my case) and is non-inlined in all importing projects. It’s not evidently declared in MSDN topic. If I don’t import it in any project, which uses it, and I have not a definition in its header file, it will be an ordinary inlined function, so I will get a linkage error. Then it seems for me that it’s agreeable to mix inlining and export/import, thought it contradicts an answer in the stackoverflow discussion, mentioned above. Am I right?
And I still don’t understand all this words about inlined functions instantiation.

I’m sorry, that I combined some questions in one topic, but I don’t know, how to divide it in separate ones, because they are united by the same issue and the same materials. However, I would be grateful, if anyone could clarify this questions for me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:27:01+00:00Added an answer on June 9, 2026 at 5:27 pm

    In fact, inline is a sort of hint for the optimizer. Compiler can still generate a real function with body, pushing args on the stack, etc. This will not break any logic. It would definitely do so if your “inline” function would have more than 10000 lines of code. Microsoft even has special __forceinline keyword. Guess why it was introduced.

    The function is always instantiated and exported ...

    The wording might be not perfect here. Instantiation means here that a body and an entry point will be generated. This has nothing to do with template instantiation. The whole paragraph means that __declspec is more important than inline.

    For dllimport they basically write that dllimport prevents generation of body of this inline function in the current binary module, while the inline expansion is still possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used a generalized additive model to analyse some data and now wish
Now I'm not sure if this is something I'm doing wrong, or something thats
I have written a GUI application which after performing some analyses on a large
To analyze lots of text logs I did some hackery that looks like this:
I've been working on my own implementation of ECMAScript for quite some time now.
This scoping problem seems like the type of C++ quandary that Scott Meyers would
Is there a way that I can Programmatically set an Expires Header in code
My goal is to analyze some corpus (twitter for the now) for emotional content.
I have written some python scripts that take advantage of pysvn to analyze a
Often I could use some tools to statically analyze my code in order to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.