Originally posted by: Pan Aimin
It is running but does not work on "Matching". A simple test shows that FREETMPS will overwrite *retval. I guess what retval holds is a temporary memory and can not be returned.
A simple fix like the following makes the "Matching" work.
inline SV* my_eval_sv(SV *sv, I32 croak_on_error)
{
dSP;
static SV my_retval;
SV* retval;
STRLEN n_a;
ENTER;
SAVETMPS;
PUSHMARK(SP);
eval_sv(sv, G_SCALAR);
SPAGAIN;
retval = POPs;
memcpy(&my_retval, retval, sizeof(SV));
PUTBACK;
FREETMPS;
LEAVE;
if (croak_on_error && SvTRUE(ERRSV))
croak(SvPVx(ERRSV, n_a));
return &my_retval;
}
Reply
Originally posted by: Olivier G. Gaumond
#include <iostream>
using namespace std;
string trim(const string& str);
int main(int argc, char* argv[])
s2 = trim(s1);
std::cout << s2 << endl;
}
string trim(const string& str)
p->Substitute(str, bgnPtrn, sTemp);
delete p;
return sTemp2;
}
I get an Access Violation on line
However if I remove the line
Olivier
Consider the following program
#include <string>
#include "PerlString.h"
{
PerlString perl;
string s2;
string s1(" blabla ");
string pattern("/^bla/");
perl.Match(s2, pattern);
{
string sTemp, sTemp2;
string bgnPtrn("s/^[\\s\\t\\n]+//");
string endPtrn("s/[\\s\\t\\n]+$//");
PerlString* p = new PerlString();
p->Substitute(sTemp, endPtrn, sTemp2);
perl.Match(s2, pattern);
delete p;
in function trim() I avoid the access violation, however I've got a memory leak. Can we use more than one instance of the PerlString class?
Originally posted by: Vasche
Can't find a reason so far, help would be appreciated.
Platform: Windows 2000 Pro
I compiled a Debug version of the sample project,
it crashes as soon as I hit Test.
Pattern I use /a, text "Test".
use perl58.lib, perl58.dll
Originally posted by: smxiang
if give input string of "345" (or any other string), and pattern of "/([0-9])/", Matches() returns 1, and matchList returns "3", okay, it works well.
but, in the above case, if give the pattern of "/[0-9]/", Matches() still returns 1, and matchList returns "1", why?
thanks for your hard work!
Xiang Siming
xiangsm@yahoo.com
2002/10/30
Originally posted by: Isaac COHEN
Hi,
I have tried to use CPerlString in a multi-thread application but I get a runtime error.
Any suggestions?
Isaac.
Originally posted by: Flavia
I am trying to run the program in embedded visual c++. Does any one have a version that can run in embedded visual c++. Please do email me asap thanks . I downloaded the demo program but there is a fatal error C1083: Cannot open precompiled header file: 'Release/PerlStringTest.pch': No such file or directory. Can someone help me pls.........
Reply
Originally posted by: Dave Yasko
Hello,
PerlString is exactly what I've been looking for. Thanks. Could you please provide some example code to use PerlString::Matches() and PerlString::Split()?
I have to use the non-MFC version, and I'm having problems with the matchList and splitList function arguments. The functions require "char *(listVar[])" types, but I can't assemble a variable of the right type.
Thanx in advance,
Dave
Reply
Originally posted by: Med
Hi,
Is it possible to link the perl56.dll statically like it's possible to link the MFC dlls so that the exe file can be ported to machines that are not running PERL?
ReplyOriginally posted by: Med
You mentioned that we need to modify the linker to access perl56.lib. Somehow, I did not manage to find this file inside my Perl/lib/CORE directory.
Any idea what went wrong? Pls help. Thks
Rgds
What version of PERL did you use? Are you using Active State PERL? I tried to compile the demo program and have 55 errors.
Originally posted by: Kevin Cazabon
Kevin.
Nicely done, works slick, thanks!