Problems with perlapi and PL_sv_undef

M

Mladen Georgiev

Hello!
I'm trying to call a perl subroutine from a C++ program via perlapi.
Here is the perl code

sub SaveDocuments {
my ( $files, @questions ) = @_;
...
}

In that subroutine $files must be array reference.
If I push &PL_sv_undef value for $files (there are no files)

XPUSHs( &PL_sv_undef );

$files is assigned the first element of @questions array (the rest of
parameters array).
Hereis how I fill @questions array in C++ code:

if ( Document->Questions != NULL ) {
for ( int i=0; i < Document->Questions->Count; i++ )
{
XPUSHs(sv_2mortal(newSVpv(Document->Questions,strlen(
Document->Questions ) )));
}
}

Where am I wrong?
Thanks in advance!

Best regards,
Mladen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top