Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Gambini

Member Since 11 Apr 2012
Offline Last Active Nov 25 2014 09:03 PM

Posts I've Made

In Topic: Should i to compile using static library or shared library?

12 October 2014 - 07:33 PM

I recently came upon this problem in Windows where there were two shared libraries compiling with Lua statically, which caused a crash when passing a lua_State* between the two. It was fixed by linking Lua as a shared library, which is a wonderfully descriptive name for when it is appropriate to use, seeing as it was shared by the two libraries.

 

It will differ per project, and most libraries will say when they are better done as static libraries. If you want some definitive answer, then link everything shared until the library explicitly says to do it static.

 

In the case of choosing static or shared, the difference in code execution speed will not be great enough to make a difference. There are some link-time optimizations that can happen with static libraries, but I wouldn't count on that bringing you from 30fps to 60fps.


In Topic: Arrgh openGL!

11 May 2013 - 09:24 AM

You should have a directory with all of your .lib files in it. Then, in the project properties (make sure you do this for Release and Debug), put that directory in to Linker->General->Additional Library Directories. The directory you give should be relative to the .vcproj file (or absolute), or another option is to use the built-in VS macros to define it relative to your solution directory by doing something like "$(SolutionDir)../lib;". Then head over to Linker->Input->Additional Dependencies and list your .lib files spearated by semicolons (or one per line if you use the drop-down menu and hit the <Edit...> option) . Make sure to hit "Apply" at the bottom right instead of just pressing "Ok". Example for the Additional dependencies, part of mine looks like "glew32.lib;opengl32.lib;glu32.lib;"

 

 

opengl32.lib should be provided by the system, so you don't have to give a specific directory for that, you should just be able to add it to the Additional Dependencies.


In Topic: problem binding a c++ function with luabind

05 May 2013 - 10:24 AM

It looks like out_value doesn't work well with MSVC (here).

 

You'll have to either re-think the function or use Lua's "string.upper" function.

 

Another option is to make your own string class with UCase as a member function. That would bind perfectly fine to Lua, since UCase wouldn't need to take any parameters and only modify the object data.


In Topic: problem binding a c++ function with luabind

04 May 2013 - 04:33 PM

http://www.rasterbar.com/products/luabind/docs.html#out-value

 

That explains how your C++ functions can't take non-const ref/pointers if you want to bind them to Lua. So, the out_value function policy will add a return value in Lua code, rather than modifying the input.

Where your C++ code would look like

char* str = "hi";
UCase(str);
std::cout << str; //prints 'HI'

Your Lua code would look like

local str = "hi"
local ucstr = UCase(str)
--// or you can have str = UCase(str)
print(ucstr) //prints 'HI'

In Topic: Porting from Visual C++ 6.0 to Visual Studio Tricks and Tips?

02 May 2013 - 12:41 PM

To narrow down your errors, you could try some static code analysis tools. If you have a fat wallet, I've heard some decent things about PVS Studio. If you are on more of a budget, then VS2012 (not sure about express) has some integrated static analysis, and there's a few other options if you search around the Internet.


PARTNERS