|
-
May 25th, 2005, 11:40 AM
#1
Is it possible to inline C++ DLL subs/functions? [RESOLVED]
I got an error trying last time, but is it possible to inline functions and subs for a DLL file?
Code:
int _stdcall test()
{
//where do I stick the inline statement at?
}
Last edited by Jacob Roman; May 26th, 2005 at 05:03 PM.
-
May 25th, 2005, 04:17 PM
#2
Re: Is it possible to inline C++ DLL subs/functions?
If you are exporting the function, then no, it doesn't make much sense to inline it since other applications need to have access to it.
If it's a helper function of some sort that is not exported, then sure, you can mark it as inline:
Code:
inline void foo()
{
}
But in your example, there's no reason to declare a calling convention *and* inline -- if you inline the function, there is no function call to be made, and hence no calling convention to be used 
Also keep in mind that the "inline" statement is merely a suggestion to the compiler -- if the compiler disagrees with you about inlining the function it won't do it, even if you mark it as inline. To work around this you can use __forceinline (visual C++) or __attribute__((always_inline)) (gcc) instead, although even then the compiler might determine that the function isn't suitable to be inlined.
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
May 25th, 2005, 04:38 PM
#3
Re: Is it possible to inline C++ DLL subs/functions?
Ok, so if there's no point of inlining when using _stdcall, is there anything else i can use or am I stuck with the way it is?
-
May 25th, 2005, 06:52 PM
#4
Re: Is it possible to inline C++ DLL subs/functions?
inlining is something that happens during compilation. A DLL isn't involved until the linking stage. So no, you can never import the functions exported from a DLL as inline.
However, the DLL usually has a header file accompanying it. Small functions that the users of the DLL might find useful might be defined as inline in there.
However, if there are no such functions, and you don't have the DLL source code, there's nothing you can do.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 26th, 2005, 05:02 PM
#5
Re: Is it possible to inline C++ DLL subs/functions?
Ok thanks. I guess it's not possible then.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|