Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Embedded Perl sprintf (symbol?) problem.

Reply
Thread Tools

Embedded Perl sprintf (symbol?) problem.

 
 
R. Cheung
Guest
Posts: n/a
 
      02-02-2004
I have a problem using sprintf in my embedded Perl interpreter. E.g.

$decVal = 1234;
$str = sprintf( "Result is %d, 0x%x", $decVal, $decVal );

$str comes back containing rubbish like "Result is 17 0x11". It seems
that sprintf can pick up the 1st parameter (the format string) but
picks up completely wrong parameters subsequently. The interpreter
seems to work fine when doing strictly Perl stuff (e.g. matching,
substituting, etc.). I'm wondering if this is a symbol clash problem.
I'm working in a Win2000 environment, embedding Perl in a Visual C++
application. Could it be that it's picking up sprintf from the VC++
library instead of Perl's own, or something like that? Does anyone
have a solution to this problem? Thanks.
 
Reply With Quote
 
 
 
 
Sisyphus
Guest
Posts: n/a
 
      02-03-2004
R. Cheung wrote:
> I have a problem using sprintf in my embedded Perl interpreter. E.g.
>
> $decVal = 1234;
> $str = sprintf( "Result is %d, 0x%x", $decVal, $decVal );
>
> $str comes back containing rubbish like "Result is 17 0x11". It seems
> that sprintf can pick up the 1st parameter (the format string) but
> picks up completely wrong parameters subsequently. The interpreter
> seems to work fine when doing strictly Perl stuff (e.g. matching,
> substituting, etc.). I'm wondering if this is a symbol clash problem.
> I'm working in a Win2000 environment, embedding Perl in a Visual C++
> application. Could it be that it's picking up sprintf from the VC++
> library instead of Perl's own, or something like that? Does anyone
> have a solution to this problem? Thanks.


Can you post some simple code that demonstrates the problem (and will
also compile) ?

Cheers,
Rob

--
To reply by email u have to take out the u in kalinaubears.

 
Reply With Quote
 
 
 
 
gnari
Guest
Posts: n/a
 
      02-03-2004
"Sisyphus" <(E-Mail Removed)> wrote in message
news:401f3cc6$0$1746$(E-Mail Removed) u...
> R. Cheung wrote:
> > I have a problem using sprintf in my embedded Perl interpreter. E.g.
> >
> > $decVal = 1234;
> > $str = sprintf( "Result is %d, 0x%x", $decVal, $decVal );
> >
> > $str comes back containing rubbish like "Result is 17 0x11". It seems
> > ...


> Can you post some simple code that demonstrates the problem (and will
> also compile) ?


I think the point was that his code works under normal perl, but not with
embedded perl.

Still, the idea is valid. the OP should try to make a minimal program w/
embedded perl, and see if the problem persists.

gnari




 
Reply With Quote
 
Sisyphus
Guest
Posts: n/a
 
      02-03-2004
gnari wrote:

> Still, the idea is valid. the OP should try to make a minimal program w/
> embedded perl, and see if the problem persists.


I'd stop short of saying that it's mandatory to provide some compilable
demonstration code - but I, for one, am certainly *not* going to think
about the problem if I have to create test code from scratch. I imagine
that others share the same attitude.

Otoh, if there was some code supplied I would certainly look at it, and
play with it, and try to determine the cause of the problem .... not to
say that I'd succeed, of course

It's just that it's simply in the best interests of the OP to follow the
posting guidelines and supply such code. That's all I was trying to get
at

Cheers,
Rob


--
To reply by email u have to take out the u in kalinaubears.

 
Reply With Quote
 
gnari
Guest
Posts: n/a
 
      02-03-2004

"Sisyphus" <(E-Mail Removed)> wrote in message
news:401f9d76$0$1734$(E-Mail Removed) u...

[snipped discussion about lack of embedded perl example code]

>
> It's just that it's simply in the best interests of the OP to follow the
> posting guidelines and supply such code. That's all I was trying to get
> at


no quarrel, but in this case, the OP would probably have to post
c code, and someone is sure to complain about that

gnari





 
Reply With Quote
 
Sisyphus
Guest
Posts: n/a
 
      02-03-2004
gnari wrote:

>
> no quarrel, but in this case, the OP would probably have to post
> c code, and someone is sure to complain about that
>


(That wouldn't stop *me* from posting code

I hadn't really considered that aspect. Such a complaint could only be
valid if 'perlembed' issues are OT here - which, admittedly, may well be
the case (and a pity, imho).

I see there's an 'embperl' mailing list at http://lists.perl.org.
Perhaps the OP should direct his question there.

Cheers,
Rob

--
To reply by email u have to take out the u in kalinaubears.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sprintf rounding with FreeBSD and perl 5.8.x cherbst@gmail.com Perl Misc 5 01-24-2008 10:10 PM
Embedded vs. Non-embedded Tests Trans Ruby 11 09-05-2007 11:22 AM
Embedded languages based on early Ada (from "Re: Preferred OS, processor family for running embedded Ada?") Colin Paul Gloster VHDL 48 04-10-2007 10:31 AM
How to display images embedded in e-mail as embedded, not attachments Jim Firefox 4 12-11-2004 05:36 AM
Databind an embedded control in an embedded datagrid Thomas Dodds ASP .Net Datagrid Control 0 07-26-2004 08:20 PM



Advertisments