Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualFDsagizi

Posted 10 May 2012 - 10:00 PM

Is it GetNode() or SetNode()?


Sorry, need go sleep!Posted Image yes i use asEP_ALLOW_UNSAFE_REFERENCES

Create example:

struct TestLink
{
	 TestLink(){ val = 123; }
	 int val;
};
TestLink *GetTestLink()
{
	 return new TestLink();
}


r=en->RegisterObjectType( "TestLink", 0, asOBJ_REF | asOBJ_NOCOUNT ); assert( r >= 0 );
r=en->RegisterObjectProperty( "TestLink", "int val", asOFFSET( TestLink, val ) ); assert( r >= 0 );
r=en->RegisterGlobalFunction("TestLink &GetTestLink()", asFUNCTION(GetTestLink), asCALL_CDECL); assert( r >= 0 );

Script:


void PrintLink_1( TestLink @ t )
{
	 print( "1 TestLink.val: " + t.val +"\n" );
}

void PrintLink_2( TestLink @&in t )
{
	 print( "2 TestLink.val: " + t.val +"\n" );
	 PrintLink_3( t );
}

void PrintLink_3( TestLink @& t )
{
	 print( "3 TestLink.val: " + t.val +"\n" );
}

void PrintLink_4( TestLink @& t )
{
	 print( "4 TestLink.val: " + t.val +"\n" );
}

void startGame( string &param )
{
	 PrintLink_1( GetTestLink() );
	 PrintLink_2( GetTestLink() );
	 PrintLink_4( GetTestLink() );

}

1 TestLink.val: 123
2 TestLink.val: 123
3 TestLink.val: 123
PrintLink_4 - crash program

as_context.cpp[ 2522 ]

case asBC_RDR4:
*(asDWORD*)(l_fp - asBC_SWORDARG0(l_bc)) = **(asDWORD**)&regs.valueRegister;
l_bc++;
break;

#6FDsagizi

Posted 10 May 2012 - 09:59 PM

Is it GetNode() or SetNode()?


Sorry, need go sleep!Posted Image yes i use asEP_ALLOW_UNSAFE_REFERENCES

Create example:

struct TestLink
{
	 TestLink(){ val = 123; }
	 int val;
};
TestLink *GetTestLink()
{
	 return new TestLink();
}


r=en->RegisterObjectType( "TestLink", 0, asOBJ_REF | asOBJ_NOCOUNT ); assert( r >= 0 );
r=en->RegisterObjectProperty( "TestLink", "int val", asOFFSET( TestLink, val ) ); assert( r >= 0 );
r=en->RegisterGlobalFunction("TestLink &GetTestLink()", asFUNCTION(GetTestLink), asCALL_CDECL); assert( r >= 0 );

Script:




void PrintLink_1( TestLink @ t )
{
	 print( "1 TestLink.val: " + t.val +"\n" );
}

void PrintLink_2( TestLink @&in t )
{
	 print( "2 TestLink.val: " + t.val +"\n" );
	 PrintLink_3( t );
}

void PrintLink_3( TestLink @& t )
{
	 print( "3 TestLink.val: " + t.val +"\n" );
}

void PrintLink_4( TestLink @& t )
{
	 print( "4 TestLink.val: " + t.val +"\n" );
}

void startGame( string &param )
{
	 PrintLink_1( GetTestLink() );
	 PrintLink_2( GetTestLink() );
	 PrintLink_4( GetTestLink() );

}



1 TestLink.val: 123

2 TestLink.val: 123

3 TestLink.val: 123

PrintLink_4 - crash program

as_context.cpp[ 2522 ]


case asBC_RDR4:
*(asDWORD*)(l_fp - asBC_SWORDARG0(l_bc)) = **(asDWORD**)&regs.valueRegister;
l_bc++;
break;

#5FDsagizi

Posted 10 May 2012 - 09:58 PM

Is it GetNode() or SetNode()?


Sorry, need go sleep!Posted Image

Yes GetNode! Code register:

r=en->RegisterObjectMethod("Xml","void GetNode(Node@&)", asMETHOD(Xml,GetNode),asCALL_THISCALL);assert(r>=0);

yes i use asEP_ALLOW_UNSAFE_REFERENCES

[edit]

Create exemple:


struct TestLink 
{
	 TestLink(){ val = 123; }
	 int val;
};
TestLink *GetTestLink()
{
	 return new TestLink();
}


r=en->RegisterObjectType( "TestLink", 0, asOBJ_REF | asOBJ_NOCOUNT ); assert( r >= 0 );
r=en->RegisterObjectProperty( "TestLink", "int val", asOFFSET( TestLink, val ) ); assert( r >= 0 );
r=en->RegisterGlobalFunction("TestLink &GetTestLink()", asFUNCTION(GetTestLink), asCALL_CDECL); assert( r >= 0 );

Script:




void PrintLink_1( TestLink @ t )
{
	 print( "1 TestLink.val: " + t.val +"\n" );
}

void PrintLink_2( TestLink @&in t )
{
	 print( "2 TestLink.val: " + t.val +"\n" );
	 PrintLink_3( t );
}

void PrintLink_3( TestLink @& t )
{
	 print( "3 TestLink.val: " + t.val +"\n" );
}

void PrintLink_4( TestLink @& t )
{
	 print( "4 TestLink.val: " + t.val +"\n" );
}

void startGame( string &param )
{
	 PrintLink_1( GetTestLink() );
	 PrintLink_2( GetTestLink() );
	 PrintLink_4( GetTestLink() );

}



1 TestLink.val: 123

2 TestLink.val: 123

3 TestLink.val: 123

PrintLink_4 - crash program

as_context.cpp[ 2522 ]


case asBC_RDR4:
*(asDWORD*)(l_fp - asBC_SWORDARG0(l_bc)) = **(asDWORD**)&regs.valueRegister;
l_bc++;
break;

#4FDsagizi

Posted 10 May 2012 - 08:58 PM

Is it GetNode() or SetNode()?


Sorry, need go sleep!Posted Image

Yes GetNode! Code register:

r=en->RegisterObjectMethod("Xml","void GetNode(Node@&)", asMETHOD(Xml,GetNode),asCALL_THISCALL);assert(r>=0);

yes i use asEP_ALLOW_UNSAFE_REFERENCES

With "@&in" work! But "@&" no work!


#3FDsagizi

Posted 10 May 2012 - 08:57 PM

Is it GetNode() or SetNode()?


Sorry, need go sleep!Posted Image

Yes GetNode! Code register:

r=en->RegisterObjectMethod("Xml","void GetNode(Node@&)", asMETHOD(Xml,GetNode),asCALL_THISCALL);assert(r>=0);

yes i use asEP_ALLOW_UNSAFE_REFERENCES

With "@&in" work!


#2FDsagizi

Posted 10 May 2012 - 08:55 PM

Is it GetNode() or SetNode()?


Sorry, need go sleep!Posted Image

Yes GetNode! Code register:

r=en->RegisterObjectMethod("Xml","void GetNode(Node@&)", asMETHOD(Xml,GetNode),asCALL_THISCALL);assert(r>=0);

With "@&in" - normal work!



but yes, i use

asEP_ALLOW_UNSAFE_REFERENCES and @& - no work!


PARTNERS