Note that there are some explanatory texts on larger screens.

plurals
  1. POargv Memory Allocation
    primarykey
    data
    text
    <p>I was wondering if someone could tell me what I am doing wrong that I get this Unhandled Exception error message:</p> <pre><code>0xC0000005: Access violation reading location 0x0000000c. </code></pre> <p>with a green pointer pointing at my first Prolog code (fid_t):</p> <p>Here is my header file:</p> <pre><code>class UserTaskProlog { public: UserTaskProlog( ArRobot* r ); ~UserTaskProlog( ); protected: int cycles; char* argv[ 1 ]; term_t tf; term_t tx; term_t goal_term; functor_t goal_functor; ArRobot* robot; void logTask( ); }; </code></pre> <p>And here is my main code:</p> <pre><code>UserTaskProlog::UserTaskProlog( ArRobot* r ) : robot( r ), robotTaskFunc( this, &amp;UserTaskProlog::logTask ) { cycles = 0; argv[ 0 ] = "libpl.dll"; argv[ 1 ] = NULL; PL_initialise( 1, argv ); PlCall( "consult( 'myPrologFile.pl' )" ); robot-&gt;addSensorInterpTask( "UserTaskProlog", 50, &amp;robotTaskFunc ); } UserTaskProlog::~UserTaskProlog( ) { robot-&gt;remSensorInterpTask( &amp;robotTaskFunc ); } void UserTaskProlog::logTask( ) { cycles++; fid_t fid = PL_open_foreign_frame( ); tf = PL_new_term_ref( ); PL_put_integer( tf, 5 ); tx = PL_new_term_ref( ); goal_term = PL_new_term_ref( ); goal_functor = PL_new_functor( PL_new_atom( "factorial" ), 2 ); PL_cons_functor( goal_term, goal_functor, tf, tx ); int fact; if ( PL_call( goal_term, NULL ) ) { PL_get_integer( tx, &amp;fact ); cout &lt;&lt; fact &lt;&lt; endl; } PL_discard_foreign_frame( fid ); } int main( int argc, char** argv ) { ArRobot robot; ArArgumentParser argParser( &amp;argc, argv ); UserTaskProlog talk( &amp;robot ); } </code></pre> <p>Thank you,</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload