Sign in to follow this  
WitchLord

AngelScript 1.10.1b STABLE (2004/12/01)

Recommended Posts

I continue my promise to keep version 1.10.1 updated with bugfixes. With this release I also wrote an article explaining the details on how to call script functions with parameters. You'll find that article in the library documentation.

Share this post


Link to post
Share on other sites
Woah! That was FASST!! Anyway i'll get to spend some time on Angelscript for the next few days! Great to be back on the saddle!!

Share this post


Link to post
Share on other sites
error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
error LNK2005: __vsnprintf already defined in LIBCMT.lib(vsnprint.obj)
error LNK2005: _free already defined in LIBCMT.lib(free.obj)
error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
error LNK2005: _strtol already defined in LIBCMT.lib(strtol.obj)
error LNK2005: _strtoul already defined in LIBCMT.lib(strtol.obj)
fatal error LNK1169: one or more multiply defined symbols found


i finally managed to port AS 1/7/x to 1.10.0b and this was what i got, i ignored LIBCMT.lib and they seem to show "invalid configuration" dring a build and throw an exception, maybe a newbie problem, but i just started the port and i hope it has an easy fix.

i'll update if i find any solutions. All i did for the port were include bstr and stdstring, change the syntaxes, if there is anysting specific i need to watch out for, i might need your help. Thank in advance.

Share this post


Link to post
Share on other sites
Make sure both AS and your app are build with the same run-time library. (Project->Settings->C/C++->Code Generation)

Share this post


Link to post
Share on other sites
Exactly. Gyrbo has the answer.

In particular you are getting these errors because you compile the library for multithreaded C runtime dll (default in AS project) and your application is probably set to singlethreaded static C runtime library (default in MSVC++ projects).

Share this post


Link to post
Share on other sites
I made the Code Generation Options similar and i got the same error during Build. When would a Build Command give an "Invalid Configuration"?

Share this post


Link to post
Share on other sites
The Build() method reports "Invalid configuration" if one of the previous calls to a register method fails. You'll have to verify the return values from the calls to the register methods to find the exact error. I suggest you do it like this:


int r;
r = RegisterObjectType(...); assert( r >= 0 );
r = RegisterObjectMethod(...); assert( r >= 0 );
r = RegisterGlobalFunction(...); assert( r >= 0 );


This will allow you to detect any invalid configurations in debug mode, and won't impact your release build.

Share this post


Link to post
Share on other sites
I am trying it out, still dont know how they would seem to work in the older version though

warning C4121: 'asUPtr' : alignment of a member was sensitive to packing

this seems to be a warning i get in Debug mode only! i'll keep it updated.

Share this post


Link to post
Share on other sites
Just as i suspected, the Assert fails on every bstr call in the function prototype declaration, i have included asBstr.cpp and asBSTR.h files, is there anything else i might need to doublecheck?

Share this post


Link to post
Share on other sites
A lot of things have changed since 1.7.1, a call to a register method that worked before may not work with 1.10.1, although most of them should.

You mentioned before that you included both bstr and stdstring, you can't use both of them. Also you should use the bstr that is found in the test_feature project, as that is tested to work correctly.

I don't put bstr in the add_on folder anymore because I'd prefer if newcomers use the stdstring instead, which is much easier to use. But in your case, that already have the bstr working it's of course easier to continue to use the bstr.

Share this post


Link to post
Share on other sites
r = engine->RegisterGlobalFunction("int AddImage( int Im, bstr caption, int x, int y, int width, int height )",
asFUNCTION(AddImage), asCALL_CDECL); assert( r >= 0);

This seems to cause the problem, basically whichever functions have a bstr in them, i would like to change it to stdstring if it's an easy step, if you can tell me how exactly to use them, cos i have used bstr only in the function prototypes. i would still prefer keeping to date rather than using a depracated method

Share this post


Link to post
Share on other sites
Ahh, that explains it. [wink]

Well, if you want to use std::string instead of string, the first thing you'll have to do is to call RegisterStdString() instead of RegisterBStr(). It will register the 'string' type (not 'bstr'), so you'll have to change all your uses of 'bstr' to 'string'. Then you'll have to change all your registered application functions to receive std::string, instead of bstr. When using std::string you'll not have to worry about deallocating the memory in the application functions as C++ will do it for you, this is why I recommend using it instead of bstr.

Also, I haven't prepared any formatting functions like bstrFormat(), so if you're using them you'll have to write them yourself. That shouldn't be too much work, just use the bstr functions as a base and change them to return a std::string instead.

Regards,
Andreas

Share this post


Link to post
Share on other sites
I dont use any of those Formatting functions so it wouldnt matter, Is there any other thing i need to keep in mind before i change to string?

Share this post


Link to post
Share on other sites
Everything seems to work fine and the new version works great! Yippee!!! Massive Performance gains, i have'nt officially tested the changes though! will get back with results!

Share this post


Link to post
Share on other sites

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