Sign in to follow this  

[ANN] CPB - Quickly access C variables and functions from LUA

This topic is 4666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

CPB is a simple, fast, and powerful binding library for LUA. Its goal is to allow seamless access to your C variables and functions from LUA with minimal effort. CPB is integrated in to your program with exactly 1 line of C code. luaopen_CPB(lua_State* L); Add in the CPB library code, recompile and you will then be able to access every C variable and function in your program from your LUA scripts. CPB offers several key features that differ from existing LUA all current binding libraries. * CPB eliminates the need to maintain bindings in your code or in a configuration file. It figures everything out from your exe without requiring any modifications to existing code or creation of definition files. * CPB works at run time on a binary level with your program. It has access to everything in your executable. It doesn’t matter how few or many C variables and functions you want to export. Any additions and changes to your program are automatically handled. * You have full control over what to expose to the script or not. Configure exactly what variables and function to bind from LUA by name with a single function. * CPB is extremely fast and very memory efficient. Bindings are just in time compiled specifically for each function signature and only binding’s that are requested will be created You can get detailed information and a download for the library from here. http://www.thomasandamy.com/projects/CPB Thomas [Edited by - Toes on March 17, 2005 8:24:08 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
sounds strange! "works at run time on a binary level with your program", that requires all function and variable names to be stored in the executeable, that is reverse engineers heaven and definately prohibitive for any comercial project that is not open-source anyway!!!

Share this post


Link to post
Share on other sites
Quote:
Original post by Toes
It will support any form of windows exe. It's not exclusive to .net.


Quote:
Link in the following MSVC.net Library files



diaguids.lib (Release DIA GUIDS)

diaguidsd.lib (Debug DIA GUIDS)

comsupp.lib



diaguids are library files that are deployed with the DIASDK on MSVC.net. Not everyone installs it so I’ve included them with the CPB source files



Ensure the following DLL is in your runtime directory

msdia71.dll



To run the demo application you may need to first register the msdia71.dll (Microsoft Debug Interface Access). On the command prompt type "regsvr32.exe msdia71.dll" in the runtime directory.



Again this should be deployed with MSVC.net with the DIASDK. Not everyone installs it so I’ve also included it with the distribution.



Under project properties ensure that Linker->Debugging->GenerateDebugInfo is set to Yes (/DEBUG) and the debug info type is Program Database. You will need to enable this for both your debug and release builds. While you compile your program you should see a file called “yourprogramname.pdb” CPD uses this data file to generate binding data for your.


I would say it is rather Visual Studio .NET centric. The .PDB file format is Visual Studio specific and the format changed from 6.0 to .NET.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I found that as well. It cannot be used without VS.NET. It won't even compile as it needs headers that apparently are only available with VS.NET.
A shame because this seems interesting. Are you sure this is the only way to get the debug information required for this to work ? Aren't there any GNU tools that can do this ?

Share this post


Link to post
Share on other sites
There are GNU tools that do this. No one's stepped up to do a port though. ;) The command line version of the .net compiler is free now days.

A version that allows you to ship it without the PDB file should be done in a few more days. So after building your initial bindings you can export a custom data file that doesn't have your symbol data.

Thomas

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Well this is all good, but if it's possible to port that will be best, as many people will want it for MAC and Linux as well, and to avoid the MS compiler. I have the Visual C++ Toolkit 2003 which is what I assume you speak of, but it seems to be missing parts of the "DIA SDK" I would need to test any of this out. So how might we do this with only GNU tools? How much of this may need to be rewritten? Also..is this any faster than using the LUA-C api? (I'd assume it to be)

Share this post


Link to post
Share on other sites
I've included all the DIA SDK components in the download, you may need to add it to your project. You can always download it separately from MS if you want.

It's just as fast to using LUA-C API directly.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hello yes that was my point, you really can't download the header files from microsoft. At least I have yet to find it on their site. I think you only get it when you buy MSVC.NET ? Since you distribute the DIA DLL's already would it be ok to add the header files to your project download? And how might we create a .PDB file without a copy of VC.NET ? Sorry for all the questions but I'm only familiar with the GNU tools..

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
msdn.microsoft.com/library/default.asp?url=/library/en-us/vssdkstrt/html/vsoriVisualStudioNETSDK.asp

"Note The following two SDKs are only available in the Enterprise edition of Visual Studio.
Debug Interface Access(DIA) SDK
.."

So I guess I can't use DIA without a copy of VS.NET.

Share this post


Link to post
Share on other sites
The DIA headers are already part of the download package. Just look in the headers in the zip. The DIA sdk is only 2 header files and a lib. It's trivially small.

I'm done with the new version, which can work without a PDB file. You DO need a PDB to initially create your bindings, but if you want to distribute your software, you can do so with just a custom CPB binary loader data.

Thomas

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Anonymous Poster
"Note The following two SDKs are only available in the Enterprise edition of Visual Studio.
Debug Interface Access(DIA) SDK
.."

If this is true, you can get into legal trouble for distributing those header files.

Share this post


Link to post
Share on other sites
The C++ version is almost complete, and the latest version doesn't require you to ship out a PDB. Otherwise it's there and functional.

Toes

Share this post


Link to post
Share on other sites

This topic is 4666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this