<div dir="ltr"><div><div><div><div>Hi All,<br><br></div>I am trying to run a simple factorial program using parrot inside my C code.<br><br></div>This is from the embed_new.pod tutorial.<br><br></div>This line in the main function seems to be giving me some errors :<br>

<br><pre><font size="4">Parrot_api_load_bytecode_file(interp, "foo.pbc", &pf)</font><br></pre><br>ashiva@ubuntu:~/Parrot/rakudo/Test$ gcc factorial.c `parrot_config embed-cflags` `parrot_config embed-ldflags`<br>

factorial.c: In function ‘main’:<br>factorial.c:65:5: warning: passing argument 2 of ‘Parrot_api_load_bytecode_file’ from incompatible pointer type [enabled by default]<br>In file included from factorial.c:2:0:<br>../parrot/include/parrot/api.h:324:12: note: expected ‘Parrot_String’ but argument is of type ‘char *’<br>

ashiva@ubuntu:~/Parrot/rakudo/Test$ <br><br></div>Can anyone please suggest what I can possibly do to avoid these errors and run the pbc ? <br><br>Thanks & Regards, <br>Ashraya<br><br></div><div class="gmail_extra"><br clear="all">

<div>Thanks & Regards,<i><br>Ashraya S Shiva</i><br></div>
<br><br><div class="gmail_quote">On Wed, Jul 24, 2013 at 12:23 AM, Ashraya <span dir="ltr"><<a href="mailto:theemeraldsoul@gmail.com" target="_blank">theemeraldsoul@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div>Oh ok.. Thanks for the clarification, Will. <br><br></div>Thank you all, for your patience. :)<br></div><div class="gmail_extra"><div class="im"><br clear="all"><div>Thanks & Regards,<i><br>Ashraya S Shiva</i><br>

</div>

<br><br></div><div><div class="h5"><div class="gmail_quote">On Wed, Jul 24, 2013 at 12:12 AM, Will Coleda <span dir="ltr"><<a href="mailto:will@coleda.com" target="_blank">will@coleda.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir="ltr"><div class="gmail_extra">FYI, I'm the partcl developer.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Some notes about the status of partcl on parrot:</div><div class="gmail_extra"><br>



</div><div class="gmail_extra"><a href="https://github.com/partcl/partcl" target="_blank">https://github.com/partcl/partcl</a> is the old, PIR based version - this version was more complete, written in PIR & C, but it is not even being tested regularly to insure that changes in parrot don't break it, as previous breaking changes are still unresolved.</div>



<div><br></div><div><a href="https://github.com/partcl/partcl-nqp" target="_blank">https://github.com/partcl/partcl-nqp</a> is newer, and is targeting the nqp-rx that ships with parrot, which is, so far as I know, no longer maintained - a snapshot is bundled in with parrot.<br>



</div><div><br></div><div>partcl-nqp  has a branch, nqp2, which is in the middle of trying to target the standalone nqp, which is being maintained. However, this is a work in progress, and I'm not sure the branch even compiles at this point. The goal is to 1) make this work with the new standalone NQP, and then to get this version as functional as the PIR version once was. But it's not an actively developed project.</div>



<div class="gmail_extra"><br></div><div class="gmail_extra">So, it looks like you're using the first version... and yes, I can reproduce your problem with my installed parrot (5.5.0-devel)</div><div class="gmail_extra">



<br></div><div class="gmail_extra">I haven't done a bisect, but it looks like this file (Tcl::Glob) was installed as part of parrot's 5.0.0-devel branch, but isn't as of 5.5.0</div><div class="gmail_extra"><br>



</div><div class="gmail_extra">So, partcl on PIR is extra broken until that's fixed, or you could try with an older parrot version.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Apologies.</div><div class="gmail_extra">



<br><div class="gmail_quote">On Tue, Jul 23, 2013 at 2:18 PM, Ashraya <span dir="ltr"><<a href="mailto:theemeraldsoul@gmail.com" target="_blank">theemeraldsoul@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



<div dir="ltr"><div><div><div><div>One more thing.. I am trying to compile TCL code here too.. <br><br></div>But it doesn't seem to work :<br><br>ashiva@ubuntu:~/Parrot/rakudo/partcl$ ../parrot/parrot tcl.pbc -e "puts {hello world}"<br>





"load_bytecode" couldn't find file 'Tcl/Glob.pir'<br>current instr.: 'prepare_lib' pc 27748 (runtime/builtin/dict.pir:102)<br>called from Sub '_main' pc 0 (src/tclsh.pir:39)<br>called from Sub '_main' pc 3 (src/tclsh.pir:42)<br>





ashiva@ubuntu:~/Parrot/rakudo/partcl$ <br><br><br></div>I read in a conversation thread that this is working.. But I am not able to understand where I am going wrong.<br><br>Please help.<br><br></div>Thanks a lot,<br></div>





Ashraya<br></div><div class="gmail_extra"><div><br clear="all"><div>Thanks & Regards,<i><br>Ashraya S Shiva</i><br></div>
<br><br></div><div><div><div class="gmail_quote">On Tue, Jul 23, 2013 at 9:54 PM, Will Coleda <span dir="ltr"><<a href="mailto:will@coleda.com" target="_blank">will@coleda.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">





<div dir="ltr">It sounds like you're trying to compile C code with parrot - Parrot is a compiler for the languages PIR and PASM, and provides an interpreter to run PBC (parrot bytecode).<div><br></div><div>You can compile C code that interoperates with parrot (using the embed/extend interface), but you cannot use parrot to compile and run C code by itself. For that, you'd use a tool like GCC.</div>






</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 23, 2013 at 11:58 AM, Ashraya <span dir="ltr"><<a href="mailto:theemeraldsoul@gmail.com" target="_blank">theemeraldsoul@gmail.com</a>></span> wrote:<br>






<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div><br>Hello Duke,<br><br></div>



Let me rephrase my question.<br><br></div>For example, I write a simple perl file, <a href="http://hello.pl" target="_blank">hello.pl</a> : <br>


</div><div>#!/usr/bin/perl<br></div>

<div>print "Hello World"<br></div><div><br>To compile this, I use :  parrot perl6.pbc <a href="http://hello.pl" target="_blank">hello.pl</a><br><br></div><div>The output is : Hello World<br><br></div><div>Similarly, if I have a C file, hello.c :<br>








<br></div><div>#include<stdio.h><br><br></div><div>int main()<br>{<br></div><div>    printf("Hello World\n");<br></div><div>    return 0;<br></div><div>}<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">








How would I compile this to get the output?<br><br></div><div class="gmail_extra">Note : I downloaded the c99 package for parrot from github but I could not get this installed.<br></div><div class="gmail_extra"><div>
<br clear="all">

<div>Thanks & Regards,<i><br>Ashraya S Shiva</i><br></div>
<br><br></div><div><div><div class="gmail_quote">On Tue, Jul 23, 2013 at 7:23 PM, Jonathan "Duke" Leto <span dir="ltr"><<a href="mailto:jonathan@leto.net" target="_blank">jonathan@leto.net</a>></span> wrote:<br>






<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Howdy Ashraya,<br>
<br>
I believe nobody is answering you because they don't quite understand<br>
what you mean.<br>
<br>
Could you ask your question another way, and give some more background<br>
about what you are trying to do?<br>
<span><font color="#888888"><br>
Duke<br>
</font></span><div><div><br>
On Sun, Jul 21, 2013 at 10:51 PM, Ashraya <<a href="mailto:theemeraldsoul@gmail.com" target="_blank">theemeraldsoul@gmail.com</a>> wrote:<br>
> A gentle reminder.. Please reply. How to convert a C code into PIR code ?<br>
><br>
> Thanks & Regards,<br>
> Ashraya S Shiva<br>
><br>
><br>
> On Wed, Jul 17, 2013 at 4:30 PM, Ashraya <<a href="mailto:theemeraldsoul@gmail.com" target="_blank">theemeraldsoul@gmail.com</a>> wrote:<br>
>><br>
>> Hello Duke,<br>
>><br>
>> I am trying one of the examples in the .pod you have given :<br>
>><br>
>>   /* foo.c */<br>
>><br>
>>   /* specify the function prototype */<br>
>>   #ifdef __WIN32<br>
>>   __declspec(dllexport) void foo(void);<br>
>>   #else<br>
>>   void foo(void);<br>
>>   #endif<br>
>><br>
>>   void foo(void) {<br>
>>     printf("Hello Parrot!\n");<br>
>>   }<br>
>><br>
>> Then, after having compiled the file as a shared library, the PIR code<br>
>> looks like this:<br>
>><br>
>><br>
>> Here, how do I compile the .c file to produce a .pir file ??<br>
>><br>
>> Thanks,<br>
>> Ashiva<br>
>><br>
>> Thanks & Regards,<br>
>> Ashraya S Shiva<br>
>><br>
>><br>
>> On Wed, Jul 17, 2013 at 2:08 AM, Jonathan "Duke" Leto <<a href="mailto:jonathan@leto.net" target="_blank">jonathan@leto.net</a>><br>
>> wrote:<br>
>>><br>
>>> Howdy,<br>
>>><br>
>>> You can embed Parrot inside of a C or C++ application. It can be any<br>
>>> language, actually (it works with FORTRAN), but we have the best docs<br>
>>> for C and C++. I have embedded Parrot inside of PostgreSQL (PL/Parrot<br>
>>> [0]), but that uses the old interface [1]. The new interface [2] is<br>
>>> infinitely better, but has not been heavily used. But it was designed<br>
>>> very well by Whiteknight, so it is high quality.<br>
>>><br>
>>> You can also call out to C/C++ libraries from parrot via "dlopen" and<br>
>>> cousins via the Native Call Interface (NCI) substem of Parrot [3].<br>
>>><br>
>>> Which of those things do you want to do, or possibly both?<br>
>>><br>
>>> Duke<br>
>>><br>
>>> [0] <a href="http://pl.parrot.org" target="_blank">http://pl.parrot.org</a><br>
>>> [1] <a href="https://github.com/parrot/parrot/blob/master/docs/embed.pod" target="_blank">https://github.com/parrot/parrot/blob/master/docs/embed.pod</a><br>
>>> [2] <a href="https://github.com/parrot/parrot/blob/master/docs/embed_new.pod" target="_blank">https://github.com/parrot/parrot/blob/master/docs/embed_new.pod</a><br>
>>> [3]<br>
>>> <a href="https://github.com/parrot/parrot/blob/master/docs/pdds/draft/pdd16_native_call.pod" target="_blank">https://github.com/parrot/parrot/blob/master/docs/pdds/draft/pdd16_native_call.pod</a><br>
>>><br>
>>><br>
>>> On Tue, Jul 16, 2013 at 4:58 AM, Ashraya S <<a href="mailto:theemeraldsoul@gmail.com" target="_blank">theemeraldsoul@gmail.com</a>><br>
>>> wrote:<br>
>>> > Hello All,<br>
>>> ><br>
>>> > I switched to my favorite Ubuntu and parrot got installed like a charm.<br>
>>> ><br>
>>> > However, I would like to know how parrot supports C program<br>
>>> > compilation.<br>
>>> > Is there any tutorial I can find ? I did not get much support for C in<br>
>>> > google. Got loads for perl and pasm.<br>
>>> ><br>
>>> > Please advise.<br>
>>> ><br>
>>> > Thanks,<br>
>>> > Ashiva<br>
>>> ><br>
>>> ><br>
>>> > On Wednesday, July 10, 2013 7:30:29 PM UTC+5:30, Coke wrote:<br>
>>> >><br>
>>> >> Do you have a C compiler installed?<br>
>>> >><br>
>>> >><br>
>>> >> On Wed, Jul 10, 2013 at 6:39 AM, Ashraya S <<a href="mailto:theemer...@gmail.com" target="_blank">theemer...@gmail.com</a>><br>
>>> >> wrote:<br>
>>> >>><br>
>>> >>> Hi All,<br>
>>> >>><br>
>>> >>> I am new to parrot and i am trying to install this in windows 7.<br>
>>> >>> I have installed perl and minGW and have added these to my PATH as<br>
>>> >>> well.<br>
>>> >>><br>
>>> >>> But i get the following error :<br>
>>> >>><br>
>>> >>> C:\Users\ashiva\Documents\GitHub\parrot>perl Configure.pl<br>
>>> >>> Parrot Version 5.5.0 Configure 2.0<br>
>>> >>> Copyright (C) 2001-2013, Parrot Foundation.<br>
>>> >>><br>
>>> >>> Hello, I'm Configure. My job is to poke and prod your system to<br>
>>> >>> figure<br>
>>> >>> out<br>
>>> >>> how to build Parrot. The process is completely automated, unless you<br>
>>> >>> passed in<br>
>>> >>> the `--ask' flag on the command line, in which case I'll prompt you<br>
>>> >>> for a<br>
>>> >>> few<br>
>>> >>> pieces of info.<br>
>>> >>><br>
>>> >>> Since you're running this program, you obviously have Perl 5--I'll be<br>
>>> >>> pulling<br>
>>> >>> some defaults from its configuration.<br>
>>> >>><br>
>>> >>> init::manifest -      Check<br>
>>> >>> MANIFEST.....................................done.<br>
>>> >>> init::defaults -      Set Configure's default<br>
>>> >>> values.....................done.<br>
>>> >>> init::install -       Set up installation<br>
>>> >>> paths..........................done.<br>
>>> >>> init::hints -         Load platform and local hints<br>
>>> >>> files................done.<br>
>>> >>> inter::progs -        Determine what C compiler and linker to<br>
>>> >>> use...Compilation<br>
>>> >>> failed with 'gcc'<br>
>>> >>><br>
>>> >>> C:\Users\ashiva\Documents\GitHub\parrot><br>
>>> >>><br>
>>> >>> Please help me resolve this problem.<br>
>>> >>><br>
>>> >>> Thanks a lot, in advance.<br>
>>> >>><br>
>>> >>> --<br>
>>> >>> Ashiva<br>
>>> >>><br>
>>> >>> _______________________________________________<br>
>>> >>> <a href="http://lists.parrot.org/mailman/listinfo/parrot-dev" target="_blank">http://lists.parrot.org/mailman/listinfo/parrot-dev</a><br>
>>> >>><br>
>>> >><br>
>>> >><br>
>>> >><br>
>>> >> --<br>
>>> >> Will "Coke" Coleda<br>
>>> ><br>
>>> ><br>
>>> > _______________________________________________<br>
>>> > <a href="http://lists.parrot.org/mailman/listinfo/parrot-dev" target="_blank">http://lists.parrot.org/mailman/listinfo/parrot-dev</a><br>
>>> ><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Jonathan "Duke" Leto <<a href="mailto:jonathan@leto.net" target="_blank">jonathan@leto.net</a>><br>
>>> Leto Labs LLC <a href="http://letolabs.com" target="_blank">http://letolabs.com</a><br>
>>> 209.691.DUKE <a href="http://duke.leto.net" target="_blank">http://duke.leto.net</a><br>
>>> @dukeleto<br>
>><br>
>><br>
><br>
<br>
<br>
<br>
--<br>
Jonathan "Duke" Leto <<a href="mailto:jonathan@leto.net" target="_blank">jonathan@leto.net</a>><br>
Leto Labs LLC <a href="http://letolabs.com" target="_blank">http://letolabs.com</a><br>
209.691.DUKE <a href="http://duke.leto.net" target="_blank">http://duke.leto.net</a><br>
@dukeleto<br>
</div></div></blockquote></div><br></div></div></div></div>
<br>_______________________________________________<br>
<a href="http://lists.parrot.org/mailman/listinfo/parrot-dev" target="_blank">http://lists.parrot.org/mailman/listinfo/parrot-dev</a><br>
<br></blockquote></div><br><br clear="all"><span><font color="#888888"><div><br></div>-- <br>Will "Coke" Coleda
</font></span></div><span><font color="#888888">
</font></span></div></div></blockquote></div><span><font color="#888888"><br></font></span></div></div></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Will "Coke" Coleda
</font></span></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>