Re: Does LuaBind recognize inline functions?

"Thomas Nelson" <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <9F43A9E9DE7344D18BE3ADC06FA5A4A4@Spawn>
You didn't mention what compiler you are using, but "inline" is usually just
a suggestion to the compiler.  

 

Luabind works through pointers to functions. An inline function has no
address since it is expanded in place. 

 

I should warn you though that placing the implementation of an inline
function in a separate compilation unit (.cpp) can lead to unpredictable
results.  One thing you might try is to remove your prototype and replace it
with the implementation in your header.

--
Thomas Nelson  [email protected]  
--------------------------------------------------------------
"If you still have gas, you're not lost".
- French explorer Pierre Frontage.
(M.Frontage was so influential in the exploration of North America many
roads are still named after him.) 

  _____  

From: Secretive Loon 

 

It seems a silly question to me but it's the only conclusion I have left. My
compiler gives the error:

Error  3          error C2065: 'AI_GetSinglePlayer' : undeclared identifier


 

for the line of code:

luabind::module( GetLua() ) [

                      luabind::def("AI_GetSinglePlayer", AI_GetSinglePlayer)

          ];

 

for the function:

inline CBasePlayer *AI_GetSinglePlayer()

{

          if ( gpGlobals->maxClients > 1 )

          {

                      return NULL;

          }

          

          return UTIL_GetLocalPlayer();

}

 

with the prototype/declaration:

inline CBasePlayer *AI_GetSinglePlayer( void );

 

Each piece of code is in a separate file. Intellisense goes to the
declaration if I right-click and select "Go to Declaration", so it knows
it's there. If I'm wrong about the inline functions, and I hope I am, what
else could I be doing wrong here? The same code worked fine for a function
with the same scope but wasn't inline. All input is appreciated.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.