Sign in to follow this  

Garbage data output on operator+ member

This topic is 2310 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

Hello,

I am currently troubleshooting an issue with my registered operator+ function returning garbage when it is used. I have not check the other operators I have defined yet for this same bug, this is the first.

Here is the test script:

[code]
void main()
{
dim2f video_res(800,600);
dim2f another_res(video_res);
dim2f total_res;
total_res = video_res + video_res;
string videoStr;
videoStr = "Video resolution: " + video_res.Width + "x" + video_res.Height + "\n";
print(videoStr);
videoStr = "Video resolution: " + another_res.Width + "x" + another_res.Height + "\n";
print(videoStr);
videoStr = "Total resolution: " + total_res.Width + "x" + total_res.Height + "\n";
print(videoStr);
total_res += total_res;
videoStr = "Total resolution: " + total_res.Width + "x" + total_res.Height + "\n";
print(videoStr);
}
[/code]


Here is the output:

[quote]Video resolution: 800x600

Video resolution: 800x600

Total resolution: 0x3.74088e-014

Total resolution: 0x3.74088e-014[/quote]


Here are the registration statements:

[code]
//This code uses bindutils.h for the constructors...
engine->RegisterObjectType("dim2f", sizeof(dimension2df), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_CLASS_CAK); assert( r >= 0 );

engine->RegisterObjectBehaviour("dim2f",asBEHAVE_CONSTRUCT,"void f()", asFUNCTION((Wrap::Construct<dimension2df>)), asCALL_CDECL_OBJLAST);
engine->RegisterObjectBehaviour("dim2f",asBEHAVE_CONSTRUCT,"void f(const dim2f &in)", asFUNCTION((Wrap::Construct1<dimension2df,dimension2df&>)),asCALL_CDECL_OBJLAST);
engine->RegisterObjectBehaviour("dim2f",asBEHAVE_CONSTRUCT,"void f(const vec2f &in)", asFUNCTION((Wrap::Construct1<dimension2df,vector2df&>)), asCALL_CDECL_OBJLAST);
engine->RegisterObjectBehaviour("dim2f",asBEHAVE_CONSTRUCT,"void f(f32 &in, f32 &in)", asFUNCTION((Wrap::Construct2<dimension2df,f32&,f32&>)), asCALL_CDECL_OBJLAST);
engine->RegisterObjectMethod("dim2f", "dim2f opAdd(const dim2f &in) const", asMETHODPR(dimension2df, operator+, (const dimension2df&) const, dimension2df), asCALL_THISCALL);
engine->RegisterObjectMethod("dim2f", "dim2f opAddAssign(const dim2f &in)", asMETHODPR(dimension2df, operator+=, (const dimension2df&), dimension2df&), asCALL_THISCALL);[/code]


Finally, here is the operator function itself:


[code]
//! Add two dimensions
dimension2d<T> operator+(const dimension2d<T>& other) const
{
return dimension2d<T>(Width+other.Width, Height+other.Height);
}
[/code]


And the source file itself: [url="http://irrlicht.sourceforge.net/docu/dimension2d_8h_source.html"]http://irrlicht.sour..._8h_source.html[/url]

Any ideas as to what I did wrong? I suspect it is something to do with a misplaced '&' symbol, but I cannot find where...Any ideas?

Thanks for your help.

Share this post


Link to post
Share on other sites
It is possible it is a problem with AngelScript. I'll investigate this.

However you don't seem to register the dimension2df::operator= method, i.e.:

[code]engine->RegisterObjectMethod("dim2f", "dim2f &opAssign(const dim2f &in)", asMETHODPR(dimension2df, operator=, (const dimension2df &), dimension2df &), asCALL_THISCALL);[/code]
It really shouldn't be necessary to register it, as you registered the type as asOBJ_POD, but there might be a problem in AngelScript so if you could give it a try and let me know if it works it would help me identify the problem.

[EDIT] I tried to reproduce this problem, but wasn't able to. What compiler are you using and what is your operative system?

Can you set a break point in the operator+ method and check if the input is correct? That at least would help narrow down where the problem might be.

Share this post


Link to post
Share on other sites
Here are all the registrations for that class:

[code]

//Object Methods
r = engine->RegisterObjectMethod("dim2f", "dim2f &opAssign(const dim2f &in)", asMETHODPR(dimension2df, operator =, (const dimension2df&), dimension2df&), asCALL_THISCALL);
assert(r >= 0);
r = engine->RegisterObjectMethod("dim2f", "dim2f &opAssign(const dim2u &in)", asMETHODPR(dimension2df, operator =, (const dimension2du&), dimension2df&), asCALL_THISCALL); assert(r >= 0);
r = engine->RegisterObjectMethod("dim2f", "dim2f &opAssign(const dim2i &in)", asMETHODPR(dimension2df, operator =, (const dimension2di&), dimension2df&), asCALL_THISCALL); assert(r >= 0);
r = engine->RegisterObjectMethod("dim2f", "bool opEquals(const dim2f &in) const", asMETHODPR(dimension2df, operator==, (const dimension2df&) const, bool), asCALL_THISCALL); assert(r >= 0);
r = engine->RegisterObjectMethod("dim2f", "bool opEquals(const vec2f &in) const", asMETHODPR(dimension2df, operator==, (const vector2df&) const, bool), asCALL_THISCALL); assert(r >= 0);
r = engine->RegisterObjectMethod("dim2f", "bool opNotEquals(const dim2f &in) const", asMETHODPR(dimension2df, operator!=, (const dimension2df&) const, bool), asCALL_THISCALL); assert(r >= 0);
r = engine->RegisterObjectMethod("dim2f", "bool opNotEquals(const vec2f &in) const", asMETHODPR(dimension2df, operator!=, (const vector2df&) const, bool), asCALL_THISCALL); assert(r >= 0);
r = engine->RegisterObjectMethod("dim2f", "dim2f opDivAssign(const f32 &in)", asMETHODPR(dimension2df, operator/=, (const f32&), dimension2df&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("dim2f", "dim2f opDiv(const f32 &in) const", asMETHODPR(dimension2df, operator/, (const f32&) const, dimension2df), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("dim2f", "dim2f opMulAssign(const f32 &in) const", asMETHODPR(dimension2df, operator*=, (const f32&), dimension2df&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("dim2f", "dim2f opMul(const f32 &in) const", asMETHODPR(dimension2df, operator*, (const f32&) const, dimension2df), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("dim2f", "dim2f opAddAssign(const dim2f &in)", asMETHODPR(dimension2df, operator+=, (const dimension2df&), dimension2df&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("dim2f", "dim2f opSubAssign(const dim2f &in)", asMETHODPR(dimension2df, operator-=, (const dimension2df&), dimension2df&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("dim2f", "dim2f opAdd(const dim2f &in) const", asMETHODPR(dimension2df, operator+, (const dimension2df&) const, dimension2df), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("dim2f", "dim2f set(const f32 &in,const f32 &in)", asMETHOD(dimension2df,set), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("dim2f", "f32 getArea() const", asMETHOD(dimension2df,getArea), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("dim2f", "dim2f getOptimalSize(bool &in,bool &in,bool &in,u32 &in) const", asMETHOD(dimension2df,getOptimalSize), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("dim2f", "dim2f getInterpolated(const dim2f &in, f32 &in) const", asMETHOD(dimension2df,getInterpolated),asCALL_THISCALL); assert( r >= 0 );
[/code]


Because it is a template function I tried to overload the assign with all the reasonable dim2X variable types. It should pick the float when it tries to find the right function.

I am using CodeBlocks 10.5 with MinGW. Did you mean a break point on the script function itself? How would I do that? All the registrations are native, so there are no wrapper functions...

Share this post


Link to post
Share on other sites
No, I meant a break point in the C++ method dimension2d<T>::operator+. When it stops there, check the this pointer and the argument to see if they have proper values.

OK, so the opAssign method is registered. Do the script work if you write the following?

[code]

dim2f video_res(800,600);

dim2f total_res;

total_res = video_res;

string videoStr;

videoStr = "Total resolution: " + total_res.Width + "x" + total_res.Height + "\n";

[/code]

Share this post


Link to post
Share on other sites
@WitchLord:Here is the output from that script:

[code]Total resolution: 800x600[/code]


I have attached a picture of the debugger watches. The 'other' variable is correctly set. *this has wrong values

[img]http://img823.imageshack.us/img823/1141/opplustroubleshooting.png[/img]

@immortius:

I do not know where else I would place the comma without causing a compiler error? The compiler is very picky about the parameters.

Share this post


Link to post
Share on other sites
Ok, so I halfway fixed the issue. I changed the registration function from:

[code]
r = engine->RegisterObjectMethod("dim2f", "dim2f opAdd(const dim2f &in) const", asMETHODPR(dimension2df, operator+, (const dimension2df&) const, dimension2df), asCALL_THISCALL);
[/code]


To:

[code]
r = engine->RegisterObjectMethod("dim2f", "dim2f& opAdd(const dim2f &in) const", asMETHODPR(dimension2df, operator+, (const dimension2df&) const, dimension2df), asCALL_THISCALL);
[/code]


And now I get the correct output:

[img]http://img838.imageshack.us/img838/216/opplustroubleshooting2.png[/img]


But I also get a SIGSEGV (segfault) at the constructor template from bindutils.h:

[img]http://img801.imageshack.us/img801/7872/opplustroubleshooting3.png[/img]


I will rewrite my own constructors and see if I can pinpoint the problem.

Share this post


Link to post
Share on other sites
I apologize if I am being too verbose in my troubleshooting efforts, I figured you'd want all the information possible. So I looked at how the constructor was receiving the arguments and tried twiddling around with the reference operators.

From this:

[code]engine->RegisterObjectBehaviour("dim2f",asBEHAVE_CONSTRUCT,"void f(const dim2f &in)", asFUNCTION((Wrap::Construct1<dimension2df,dimension2df&>)),asCALL_CDECL_OBJLAST);[/code]

To this:

[code]engine->RegisterObjectBehaviour("dim2f",asBEHAVE_CONSTRUCT,"void f(const dim2f &in)", asFUNCTION((Wrap::Construct1<dimension2df,dimension2df>)),asCALL_CDECL_OBJLAST);[/code]

Which got me another segfault, this time it looks like a whole bunch of memory got overwritten or something:

[img]http://img837.imageshack.us/img837/9179/opplustroubleshooting4.png[/img]




So I switched back to a non templated wrapper function for the constructor for this issue:

[code]static void dim2fC(const dimension2df &other, dimension2df *self)
{
new(self) dimension2df(other);
}
[/code]


New registration function for it:

[code]engine->RegisterObjectBehaviour("dim2f",asBEHAVE_CONSTRUCT,"void f(const dim2f &in)", asFUNCTION(dim2fC), asCALL_CDECL_OBJLAST);[/code]


operator+ registration code:

[code]r = engine->RegisterObjectMethod("dim2f", "dim2f &opAdd(const dim2f &in) const", asMETHODPR(dimension2df, operator+, (const dimension2df&) const, dimension2df), asCALL_THISCALL);[/code]


And I no longer get a segfault, but in the constructor wrapper the *self pointer isn't getting the right values:

[img]http://img594.imageshack.us/img594/8272/opplustroubleshooting5.png[/img]


So, upon switch the operator+ registration function back to the original:

[code]r = engine->RegisterObjectMethod("dim2f", "dim2f opAdd(const dim2f &in) const", asMETHODPR(dimension2df, operator+, (const dimension2df&) const, dimension2df), asCALL_THISCALL);[/code]

...it made no difference, the constructor sees the exact same value for self. I am stumped at this point...I don't understand why it doesn't get the correct value...

Share this post


Link to post
Share on other sites
That changing the signature to return the value by & indicates that AngelScript is thinking the dimension2df type must be returned in memory (thus passing a hidden pointer as the first argument to the function).

This tells me there is a problem with the configuration for MinGW on Windows in as_config.h.


The constructors didn't have any problem, neither the assignment operator. You've already shown that with your tests. The only problem seems to be when the method returns the type by value.


Would it be possible for you to run the test_feature project with your compiler to check which tests in the main.cpp that fail?

Share this post


Link to post
Share on other sites
Hidden
[quote name='WitchLord' timestamp='1313120096' post='4848088']
That changing the signature to return the value by & indicates that AngelScript is thinking the dimension2df type must be returned in memory (thus passing a hidden pointer as the first argument to the function).

This tells me there is a problem with the configuration for MinGW on Windows in as_config.h.


The constructors didn't have any problem, neither the assignment operator. You've already shown that with your tests. The only problem seems to be when the method returns the type by value.


Would it be possible for you to run the test_feature project with your compiler to check which tests in the main.cpp that fail?
[/quote]

During the compile of the "test_feature" project, the compiler failed on the following:

[code]
E:\pb\angelscript_2.21.0\tests\test_feature\source\test_registertype.cpp||In function 'bool TestRegisterType::TestHandleType()':|
E:\pb\angelscript_2.21.0\tests\test_feature\source\test_registertype.cpp|889|error: 'asOBJ_ASHANDLE' was not declared in this scope|[/code]

Share this post


Link to post
Hey, thanks for the response. I tried to compile the test_feature project but I'm getting a ton of linker errors, even after recompiling the static library:


[code]
||=== codeblocks, Debug ===|
obj\Debug\source\main.o||In function `main':|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\main.cpp|192|undefined reference to `Test_Addon_ScriptHandle::Test()'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\main.cpp|193|undefined reference to `TestDefaultArg::Test()'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\main.cpp|194|undefined reference to `TestScriptRetRef::Test()'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\main.cpp|195|undefined reference to `TestGarbageCollect::Test()'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\main.cpp|196|undefined reference to `TestFunctionPtr::Test()'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\main.cpp|197|undefined reference to `TestModule::Test()'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\main.cpp|198|undefined reference to `TestGetSet::Test()'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\main.cpp|199|undefined reference to `Test_Addon_ScriptArray::Test()'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\main.cpp|200|undefined reference to `TestOperator::Test()'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\main.cpp|304|undefined reference to `TestCDeclReturn::Test()'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\main.cpp|316|undefined reference to `TestCDecl_ClassK()'|
obj\Debug\source\test_any.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_any.cpp|111|undefined reference to `RegisterScriptString_Generic(asIScriptEngine*)'|
obj\Debug\source\test_any.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_any.cpp|142|undefined reference to `RegisterScriptString_Generic(asIScriptEngine*)'|
obj\Debug\source\test_any.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_any.cpp|182|undefined reference to `RegisterScriptString_Generic(asIScriptEngine*)'|
obj\Debug\source\test_any.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_any.cpp|209|undefined reference to `RegisterScriptString_Generic(asIScriptEngine*)'|
obj\Debug\source\test_any.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_any.cpp|263|undefined reference to `CScriptString::Release() const'|
obj\Debug\source\test_argref.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_argref.cpp|43|undefined reference to `RegisterScriptString_Generic(asIScriptEngine*)'|
obj\Debug\source\test_array.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_array.cpp|156|undefined reference to `RegisterScriptString_Generic(asIScriptEngine*)'|
obj\Debug\source\test_arrayhandle.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_arrayhandle.cpp|56|undefined reference to `RegisterScriptString_Generic(asIScriptEngine*)'|
obj\Debug\source\test_arrayintf.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_arrayintf.cpp|35|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_autohandle.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_autohandle.cpp|73|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_autohandle.o||In function `A':|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_autohandle.cpp|43|undefined reference to `CScriptString::CScriptString()'|
obj\Debug\source\test_autohandle.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_autohandle.cpp|109|undefined reference to `CScriptString::Release() const'|
obj\Debug\source\test_autohandle.o||In function `~A':|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_autohandle.cpp|47|undefined reference to `CScriptString::Release() const'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_autohandle.cpp|47|undefined reference to `CScriptString::Release() const'|
obj\Debug\source\test_autohandle.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_autohandle.cpp|31|undefined reference to `CScriptString::CScriptString()'|
obj\Debug\source\test_autohandle.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_autohandle.cpp|24|undefined reference to `CScriptString::Release() const'|
obj\Debug\source\test_autohandle.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_autohandle.cpp|15|undefined reference to `CScriptString::Release() const'|
obj\Debug\source\test_bits.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_bits.cpp|82|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_bool.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_bool.cpp|221|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_castop.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_castop.cpp|76|undefined reference to `CScriptString::CScriptString(std::string const&)'|
obj\Debug\source\test_castop.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_castop.cpp|175|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_compiler.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_compiler.cpp|1822|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_compiler.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_compiler.cpp|1856|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_compiler.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_compiler.cpp|266|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_compiler.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_compiler.cpp|680|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_compiler.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_compiler.cpp|706|undefined reference to `RegisterScriptString_Generic(asIScriptEngine*)'|
obj\Debug\source\test_compiler.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_compiler.cpp|773|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_compiler.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_compiler.cpp|807|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_compiler.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_compiler.cpp|869|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_compiler.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_compiler.cpp|1070|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_compiler.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_compiler.cpp|1193|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_condition.o||In function `formatUI':|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_condition.cpp|55|undefined reference to `CScriptString::CScriptString(std::string const&)'|
obj\Debug\source\test_condition.o||In function `formatf':|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_condition.cpp|47|undefined reference to `CScriptString::CScriptString(std::string const&)'|
obj\Debug\source\test_condition.o||In function `Z13TestConditionv':|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_condition.cpp|70|undefined reference to `CScriptString::CScriptString()'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_condition.cpp|74|undefined reference to `RegisterScriptString_Generic(asIScriptEngine*)'|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_condition.cpp|163|undefined reference to `CScriptString::Release() const'|
obj\Debug\source\test_constobject.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_constobject.cpp|109|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
obj\Debug\source\test_constructor.o||In function `Z15TestConstructorv':|
E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_constructor.cpp|77|undefined reference to `RegisterScriptString_Generic(asIScriptEngine*)'|
obj\Debug\source\test_debug.o:E:\pb\angelscript_2.21.0\sdk\tests\test_feature\source\test_debug.cpp|281|undefined reference to `RegisterScriptString(asIScriptEngine*)'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|[/code]


Working on getting the test_feature codeblocks project to link. I noticed it complained about some files being missing from the project. scriptstring and a few bstr.cpp files I think it was.

Share this post


Link to post
Share on other sites
The project files is probably very outdated. You need to add all the source files in the /tests/test_features/source + all the source files for the add-ons to the project in order to make it compile.

Share this post


Link to post
Share on other sites
My results:

[code]

TestVirtualInheritance: GNUC: AngelScript cannot detect virtual inheritance thus
this test doesn't apply
-- TestVirtualInheritance passed
-- TestStdcall4Args passed
-- TestNotComplexStdcall passed
---------
MEMORY STATISTICS
number of allocations : 351978
max allocated memory at any one time : 160916
max number of simultaneous allocations: 2519
total amount of allocated memory : 36187731
medium size of allocations : 102
--------------------------------------------
All of the tests passed with success.

Press any key to quit.
[/code]

Share this post


Link to post
Share on other sites
In visual studio 2010 the script executes as it should. So it happens only when I compile using CodeBlocks...is there anything I can do to patch it?

EDIT: I've spent the last few hours attempting to plug in defines in as_config.h and nothing seems to work so far. What would be set incorrectly in as_config.h?

Share this post


Link to post
Share on other sites
Since all the tests in test_feature passed and your code works with msvc this can only mean that there is something in particular with dimension2d that makes mingw treat it differently.

As this is a new scenario I think I'll have to install code::blocks myself in order to figure out what it is that makes this class unique.

I'll try to find the time to do it this weekend and I'll let you know how it goes.

Share this post


Link to post
Share on other sites
The dimension2d class is from the free graphics API Irrlicht 1.7:

[url="http://irrlicht.sourceforge.net/index.html"]http://irrlicht.sourceforge.net/index.html[/url]

[url="http://irrlicht.sourceforge.net/docu/index.html"]http://irrlicht.sourceforge.net/docu/index.html[/url]

Thank you for your help.

Share this post


Link to post
Share on other sites
I figured it out. It wasn't a bug after all.

Despite the dimension2d template having what appears to be a copy constructor and assignment operator, the C++ compiler is not considering them as such because they are not explicitly declared with the type name. For this reason this type must be registered with the flag asOBJ_APP_CLASS_C and not asOBJ_APP_CLASS_CAK.

Regards,
Andreas

Share this post


Link to post
Share on other sites
I have confirmed this to work:

Video resolution: 800x600

Video resolution: 800x600

Total resolution: 1600x1200

Total resolution: 800x600

So, I should double check the type class parameter next time. Thank you so much!!

Share this post


Link to post
Share on other sites

This topic is 2310 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