perl.inline http://www.nntp.perl.org/group/perl.inline/ ... Copyright 1998-2017 perl.org Thu, 27 Apr 2017 20:01:07 +0000 ask@perl.org RE: Inline::C Cookbook addition by Konovalov, Vadim Too much attention to unrelated details such as SvPV_nolen <br/> <br/>With this amount of explanations - I would throw away closely unrelated text but in return insert there another colorful examples, which in turn uncover something useful. <br/> <br/>And even I would remove &quot;use warnings;&quot; line - inserting it here there and everywhere is just eating useful screen space of information. <br/> <br/>The shorter the better... <br/>Consider that you&#39;ve already convinced all around people to actually insert this &quot;use warnings;&quot; and no more need to convince people even more. <br/> <br/>Other than that - nice wording, nice effort, thank you for that, you&#39;re making world better :):) <br/> <br/> <br/>From: Ron Grunwald via inline [mailto:inline@perl.org] <br/>Sent: Sunday, February 05, 2017 5:38 PM <br/>To: inline@perl.org <br/>Subject: Re: Inline::C Cookbook addition <br/> <br/>Hi all, <br/> <br/>Just providing an update to this thread. I did end up submitting an updated &quot;Cookbook.swim&quot; as a pull request with the help of several contributors. A few days ago, Ingy was kind enough to merge the change with the Inline::C master branch. <br/> <br/>The new recipe is titled &quot;Direct Access to Perl variables&quot; and is placed at the end of the section &quot;Meat &amp; Potatoes&quot;. <br/> <br/>Thank you to everyone who assisted me. <br/> <br/>Cheers, <br/>Ron. <br/>On 21 Dec 2016, at 7:16 am, sisyphus1@optusnet.com.au&lt;mailto:sisyphus1@optusnet.com.au&gt; wrote: <br/> <br/>From: Ron Grunwald <br/>Sent: Wednesday, December 21, 2016 9:33 AM <br/>To: sisyphus1@optusnet.com.au&lt;mailto:sisyphus1@optusnet.com.au&gt; <br/>Cc: inline@perl.org&lt;mailto:inline@perl.org&gt; <br/>Subject: Re: Inline::C Cookbook addition <br/> <br/> <br/>This mailing list is very quiet these days and I think your request will probably fall &quot;through the cracks&quot; unless you submit it as a github &quot;Issue&quot; or a github pull request. <br/> <br/>For completeness, I did write up the recipe and submitted it as an issue on github about 3 days ago, <br/> <br/>https://github.com/ingydotnet/inline-c-pm/issues/56 <br/> <br/>There havn&#39;t been any comments made so far, so I&#39;m not sure if its being considered for the C Cookbook. <br/>Also, it looks like no updates were made to Inline::C for the last two years. <br/> <br/>Cheers, <br/>Ron <br/> <br/>Hi Ron, <br/> <br/>Yes, I don&#39;t know when your request will be acted upon. <br/> <br/>But it&#39;s now in a place where it won&#39;t get lost - and whenever someone decides to update Inline::C they should see that request and give it the consideration it deserves. <br/> <br/>Cheers, <br/>Rob <br/> http://www.nntp.perl.org/group/perl.inline/2017/02/msg4767.html Sun, 05 Feb 2017 18:46:00 +0000 Re: Inline::C Cookbook addition by Ron Grunwald via inline Hi all, <br/> <br/>Just providing an update to this thread. I did end up submitting an updated &quot;Cookbook.swim&quot; as a pull request with the help of several contributors. A few days ago, Ingy was kind enough to merge the change with the Inline::C master branch. <br/> <br/>The new recipe is titled &quot;Direct Access to Perl variables&quot; and is placed at the end of the section &quot;Meat &amp; Potatoes&quot;. <br/> <br/>Thank you to everyone who assisted me. <br/> <br/>Cheers, <br/>Ron. <br/> <br/>&gt; On 21 Dec 2016, at 7:16 am, sisyphus1@optusnet.com.au wrote: <br/>&gt; <br/>&gt; From: Ron Grunwald <br/>&gt; Sent: Wednesday, December 21, 2016 9:33 AM <br/>&gt; To: sisyphus1@optusnet.com.au <br/>&gt; Cc: inline@perl.org <br/>&gt; Subject: Re: Inline::C Cookbook addition <br/>&gt; <br/>&gt;&gt;&gt; This mailing list is very quiet these days and I think your request will probably fall &quot;through the cracks&quot; unless you submit it as a github &quot;Issue&quot; or a github pull request. <br/>&gt;&gt; <br/>&gt;&gt; For completeness, I did write up the recipe and submitted it as an issue on github about 3 days ago, <br/>&gt;&gt; <br/>&gt;&gt; https://github.com/ingydotnet/inline-c-pm/issues/56 <br/>&gt;&gt; <br/>&gt;&gt; There havn&#39;t been any comments made so far, so I&#39;m not sure if its being considered for the C Cookbook. <br/>&gt;&gt; Also, it looks like no updates were made to Inline::C for the last two years. <br/>&gt;&gt; <br/>&gt;&gt; Cheers, <br/>&gt;&gt; Ron <br/>&gt; <br/>&gt; Hi Ron, <br/>&gt; <br/>&gt; Yes, I don&#39;t know when your request will be acted upon. <br/>&gt; <br/>&gt; But it&#39;s now in a place where it won&#39;t get lost - and whenever someone decides to update Inline::C they should see that request and give it the consideration it deserves. <br/>&gt; <br/>&gt; Cheers, <br/>&gt; Rob <br/> http://www.nntp.perl.org/group/perl.inline/2017/02/msg4766.html Sun, 05 Feb 2017 14:38:28 +0000 Re: Inline::C Cookbook addition by Ron Grunwald via inline Hi Rob, <br/> <br/>You&#39;ve made a very good point - thank you. <br/> <br/>I am actually quite interested to update the FORTRAN recipe of the Cookbook also. The FORTRAN 2003 standard introduced interoperability with C features. This should greatly simplify invoking modern FORTRAN program units from Inline::C. <br/> <br/>The example I have in mind is writing a FORTRAN MODULE that performs matrix multiplication using the MATMUL intrinsic function. The minimum FORTRAN compiler that would be used is G95, which does offer C interoperability. <br/> <br/>Anyway, I&#39;ll think about this a bit more. <br/> <br/>Cheers, <br/>Ron. <br/> <br/>&gt; On 21 Dec 2016, at 7:16 am, &lt;sisyphus1@optusnet.com.au&gt; &lt;sisyphus1@optusnet.com.au&gt; wrote: <br/>&gt; <br/>&gt; From: Ron Grunwald <br/>&gt; Sent: Wednesday, December 21, 2016 9:33 AM <br/>&gt; To: sisyphus1@optusnet.com.au <br/>&gt; Cc: inline@perl.org <br/>&gt; Subject: Re: Inline::C Cookbook addition <br/>&gt; <br/>&gt;&gt;&gt; This mailing list is very quiet these days and I think your request will probably fall &quot;through the cracks&quot; unless you submit it as a github &quot;Issue&quot; or a github pull request. <br/>&gt;&gt; <br/>&gt;&gt; For completeness, I did write up the recipe and submitted it as an issue on github about 3 days ago, <br/>&gt;&gt; <br/>&gt;&gt; https://github.com/ingydotnet/inline-c-pm/issues/56 <br/>&gt;&gt; <br/>&gt;&gt; There havn&#39;t been any comments made so far, so I&#39;m not sure if its being considered for the C Cookbook. <br/>&gt;&gt; Also, it looks like no updates were made to Inline::C for the last two years. <br/>&gt;&gt; <br/>&gt;&gt; Cheers, <br/>&gt;&gt; Ron <br/>&gt; <br/>&gt; Hi Ron, <br/>&gt; <br/>&gt; Yes, I don&#39;t know when your request will be acted upon. <br/>&gt; <br/>&gt; But it&#39;s now in a place where it won&#39;t get lost - and whenever someone decides to update Inline::C they should see that request and give it the consideration it deserves. <br/>&gt; <br/>&gt; Cheers, <br/>&gt; Rob <br/> <br/> http://www.nntp.perl.org/group/perl.inline/2016/12/msg4765.html Thu, 22 Dec 2016 14:34:35 +0000 Re: Inline::C Cookbook addition by sisyphus1 From: Ron Grunwald<br/>Sent: Wednesday, December 21, 2016 9:33 AM<br/>To: sisyphus1@optusnet.com.au<br/>Cc: inline@perl.org<br/>Subject: Re: Inline::C Cookbook addition<br/><br/>&gt;&gt; This mailing list is very quiet these days and I think your request will <br/>&gt;&gt; probably fall &quot;through the cracks&quot; unless you submit it as a github <br/>&gt;&gt; &quot;Issue&quot; or a github pull request.<br/>&gt;<br/>&gt; For completeness, I did write up the recipe and submitted it as an issue <br/>&gt; on github about 3 days ago,<br/>&gt;<br/>&gt; https://github.com/ingydotnet/inline-c-pm/issues/56<br/>&gt;<br/>&gt; There havn&#39;t been any comments made so far, so I&#39;m not sure if its being <br/>&gt; considered for the C Cookbook.<br/>&gt; Also, it looks like no updates were made to Inline::C for the last two <br/>&gt; years.<br/>&gt;<br/>&gt; Cheers,<br/>&gt; Ron<br/><br/>Hi Ron,<br/><br/>Yes, I don&#39;t know when your request will be acted upon.<br/><br/>But it&#39;s now in a place where it won&#39;t get lost - and whenever someone <br/>decides to update Inline::C they should see that request and give it the <br/>consideration it deserves.<br/><br/>Cheers,<br/>Rob <br/><br/> http://www.nntp.perl.org/group/perl.inline/2016/12/msg4764.html Tue, 20 Dec 2016 23:17:20 +0000 Re: Inline::C Cookbook addition by Ron Grunwald via inline Hi all, <br/> <br/>&gt; This mailing list is very quiet these days and I think your request will probably fall &quot;through the cracks&quot; unless you submit it as a github &quot;Issue&quot; or a github pull request. <br/> <br/> <br/>For completeness, I did write up the recipe and submitted it as an issue on github about 3 days ago, <br/> <br/>https://github.com/ingydotnet/inline-c-pm/issues/56 &lt;https://github.com/ingydotnet/inline-c-pm/issues/56&gt; <br/> <br/>There havn&#39;t been any comments made so far, so I&#39;m not sure if its being considered for the C Cookbook. <br/>Also, it looks like no updates were made to Inline::C for the last two years. <br/> <br/>Cheers, <br/>Ron. <br/> <br/>&gt; On 8 Dec 2016, at 3:08 pm, sisyphus1@optusnet.com.au wrote: <br/>&gt; <br/>&gt; <br/>&gt; From: Ron Grunwald via inline <br/>&gt; Sent: Thursday, December 08, 2016 1:44 AM <br/>&gt; To: inline@perl.org <br/>&gt; Subject: Inline::C Cookbook addition <br/>&gt; Hello all, <br/>&gt; <br/>&gt;&gt; The code example: <br/>&gt;&gt; <br/>&gt;&gt; use strict; <br/>&gt;&gt; use warnings; <br/>&gt;&gt; use Inline C =&gt; Config =&gt; ccflagsex =&gt; &quot;-std=c99&quot;; <br/>&gt;&gt; use Inline C =&gt; &quot;DATA&quot;; <br/>&gt;&gt; <br/>&gt;&gt; our $mesh_data = &quot;MESH-POINTS 0.0 0.0 0.5 0.25 1.0 0.5 1.5 0.75&quot;; <br/>&gt;&gt; CalcSurfaceHeights(); <br/>&gt;&gt; <br/>&gt;&gt; __DATA__ <br/>&gt;&gt; __C__ <br/>&gt;&gt; #define N_MP 4 <br/>&gt;&gt; <br/>&gt;&gt; void CalcSurfaceHeights() { <br/>&gt;&gt; double x[N_MP], y[N_MP], z; <br/>&gt;&gt; char *mesh_data = SvPV_nolen(get_sv(&quot;main::mesh_data&quot;, 0)); <br/>&gt;&gt; <br/>&gt;&gt; sscanf(mesh_data, &quot;MESH-POINTS %lf%lf%lf%lf%lf%lf%lf%lf&quot;, <br/>&gt;&gt; x, y, x+1, y+1, x+2, y+2, x+3, y+3); <br/>&gt;&gt; <br/>&gt;&gt; for (int ix=0; ix &lt; N_MP; ix++) { <br/>&gt;&gt; z = 0.5*( sin(x[ix]) + sin(y[ix]) ); <br/>&gt;&gt; <br/>&gt;&gt; printf(&quot;Surface-Height: %6.3f Mesh-Point: %6.2f, %6.2f\n&quot;, <br/>&gt;&gt; z, x[ix], y[ix]); <br/>&gt;&gt; } <br/>&gt;&gt; } <br/>&gt; <br/>&gt; The &quot;use Inline C =&gt; Config =&gt; ...&quot; line can be removed if you rewrite the __C__ section as: <br/>&gt; <br/>&gt; __DATA__ <br/>&gt; __C__ <br/>&gt; #define N_MP 4 <br/>&gt; <br/>&gt; void CalcSurfaceHeights() { <br/>&gt; double x[N_MP], y[N_MP], z; <br/>&gt; int ix; <br/>&gt; char *mesh_data = SvPV_nolen(get_sv(&quot;main::mesh_data&quot;, 0)); <br/>&gt; <br/>&gt; sscanf(mesh_data, &quot;MESH-POINTS %lf%lf%lf%lf%lf%lf%lf%lf&quot;, <br/>&gt; x, y, x+1, y+1, x+2, y+2, x+3, y+3); <br/>&gt; <br/>&gt; for (ix=0; ix &lt; N_MP; ix++) { <br/>&gt; z = 0.5*( sin(x[ix]) + sin(y[ix]) ); <br/>&gt; <br/>&gt; printf(&quot;Surface-Height: %6.3f Mesh-Point: %6.2f, %6.2f\n&quot;, <br/>&gt; z, x[ix], y[ix]); <br/>&gt; } <br/>&gt; } <br/>&gt; <br/>&gt; All I&#39;ve done is move the declaration of &quot;ix&quot; from the for() loop to the declaration section at the beginning of CalcSurfaceHeights(). <br/>&gt; This then enables the code to compile using compilers (such as Microsoft compilers) that are not C99-compliant. <br/>&gt; <br/>&gt; This mailing list is very quiet these days and I think your request will probably fall &quot;through the cracks&quot; unless you submit it as a github &quot;Issue&quot; or a github pull request. <br/>&gt; <br/>&gt; Cheers, <br/>&gt; Rob <br/>&gt; <br/> http://www.nntp.perl.org/group/perl.inline/2016/12/msg4763.html Tue, 20 Dec 2016 22:33:22 +0000 Re: Inline::C Cookbook addition by Ron Grunwald via inline Hi Rob, <br/> <br/>Thank you for testing the example with your compiler, and also thank you for the wonderful advice. I will remove the index variable declaration from the for loop. <br/> <br/>&gt;&gt; for (int ix=0; ix &lt; N_MP; ix++) { <br/> <br/>Cheers, <br/>Ron. <br/> <br/>&gt; On 9 Dec 2016, at 7:24 am, &lt;sisyphus1@optusnet.com.au&gt; &lt;sisyphus1@optusnet.com.au&gt; wrote: <br/>&gt; <br/>&gt; Hi Ron, <br/>&gt; <br/>&gt; The original rendition compiles on Windows ok if the compiler being used is gcc. (I think you said you had tested it on ActivePerl 5.24.0 and found it to be fine.) <br/>&gt; <br/>&gt; However, with my MS compiler (Microsoft (R) C/C++ Optimizing Compiler Version 14.00.40310.41 for AMD64), I got: <br/>&gt; <br/>&gt; Microsoft (R) Program Maintenance Utility Version 7.00.8882 <br/>&gt; Copyright (C) Microsoft Corp 1988-2000. All rights reserved. <br/>&gt; <br/>&gt; cl -c -I&quot;C:/_32/pscrpt/inline&quot; -nologo -GF -W3 -MD -Zi -DNDEBUG -Ox -G <br/>&gt; L -fp:precise -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -DPERL_TEXTM <br/>&gt; ODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUS <br/>&gt; E_PERLIO -std=c99 -MD -Zi -DNDEBUG -Ox -GL -fp:precise -DVERSION=\&quot;0.00\&quot; -D <br/>&gt; XS_VERSION=\&quot;0.00\&quot; &quot;-IC:\_64\ap1600\lib\CORE&quot; try_pl_7dcf.c <br/>&gt; cl : Command line warning D9002 : ignoring unknown option &#39;-std=c99&#39; <br/>&gt; <br/>&gt; <br/>&gt; Admittedly, that MS compiler is getting a little bit old but my understanding is that even the most recent MS compilers are not C99 compliant (as MS like to make up their own rules). <br/>&gt; FAIK there might also be other non C99 compliant compilers in use. <br/>&gt; <br/>&gt; Both ActiveState and StrawberryPerl provide gcc-based perls for Windows, but there are still people using MS compilers with perl on Windows. (I&#39;m not really one of those people - I keep that MS compiler for reference only.) <br/>&gt; <br/>&gt; So I think, for a cookbook especially, it&#39;s best to code for the lowest common denominator unless that&#39;s impractical - though I&#39;m sure that use of non C99 compliant compilers with perl is the exception rather than the rule. <br/>&gt; <br/>&gt; Cheers, <br/>&gt; Rob <br/>&gt; <br/>&gt; -----Original Message----- From: Ron Grunwald via inline <br/>&gt; Sent: Friday, December 09, 2016 9:27 AM <br/>&gt; To: sisyphus1@optusnet.com.au <br/>&gt; Cc: inline@perl.org <br/>&gt; Subject: Re: Inline::C Cookbook addition <br/>&gt; <br/>&gt; Hi Rob, <br/>&gt; <br/>&gt; So I gather that the example in its original state did not compile on Windows? I would be somewhat surprised that there are still C compilers in use that are not C99 compliant. <br/>&gt; <br/>&gt; Many thanks for your suggestions, and I will follow your advice on using the github process. <br/>&gt; <br/>&gt; Cheers, <br/>&gt; Ron. <br/>&gt; <br/>&gt;&gt; On 8 Dec 2016, at 3:08 pm, sisyphus1@optusnet.com.au wrote: <br/>&gt;&gt; <br/>&gt;&gt; The &quot;use Inline C =&gt; Config =&gt; ...&quot; line can be removed if you rewrite the __C__ section as: <br/>&gt;&gt; <br/>&gt;&gt; __DATA__ <br/>&gt;&gt; __C__ <br/>&gt;&gt; #define N_MP 4 <br/>&gt;&gt; <br/>&gt;&gt; void CalcSurfaceHeights() { <br/>&gt;&gt; double x[N_MP], y[N_MP], z; <br/>&gt;&gt; int ix; <br/>&gt;&gt; char *mesh_data = SvPV_nolen(get_sv(&quot;main::mesh_data&quot;, 0)); <br/>&gt;&gt; <br/>&gt;&gt; sscanf(mesh_data, &quot;MESH-POINTS %lf%lf%lf%lf%lf%lf%lf%lf&quot;, <br/>&gt;&gt; x, y, x+1, y+1, x+2, y+2, x+3, y+3); <br/>&gt;&gt; <br/>&gt;&gt; for (ix=0; ix &lt; N_MP; ix++) { <br/>&gt;&gt; z = 0.5*( sin(x[ix]) + sin(y[ix]) ); <br/>&gt;&gt; <br/>&gt;&gt; printf(&quot;Surface-Height: %6.3f Mesh-Point: %6.2f, %6.2f\n&quot;, <br/>&gt;&gt; z, x[ix], y[ix]); <br/>&gt;&gt; } <br/>&gt;&gt; } <br/>&gt;&gt; <br/>&gt;&gt; All I&#39;ve done is move the declaration of &quot;ix&quot; from the for() loop to the declaration section at the beginning of CalcSurfaceHeights(). <br/>&gt;&gt; This then enables the code to compile using compilers (such as Microsoft compilers) that are not C99-compliant. <br/>&gt;&gt; <br/>&gt;&gt; This mailing list is very quiet these days and I think your request will probably fall &quot;through the cracks&quot; unless you submit it as a github &quot;Issue&quot; or a github pull request. <br/>&gt;&gt; <br/>&gt;&gt; Cheers, <br/>&gt;&gt; Rob <br/> http://www.nntp.perl.org/group/perl.inline/2016/12/msg4762.html Fri, 09 Dec 2016 23:02:53 +0000 Re: Inline::C Cookbook addition by sisyphus1 Hi Ron,<br/><br/>The original rendition compiles on Windows ok if the compiler being used is <br/>gcc. (I think you said you had tested it on ActivePerl 5.24.0 and found it <br/>to be fine.)<br/><br/>However, with my MS compiler (Microsoft (R) C/C++ Optimizing Compiler <br/>Version 14.00.40310.41 for AMD64), I got:<br/><br/>########################################<br/>C:\_32\pscrpt\inline&gt;perl try.pl<br/><br/>Microsoft (R) Program Maintenance Utility Version 7.00.8882<br/>Copyright (C) Microsoft Corp 1988-2000. All rights reserved.<br/><br/>Running Mkbootstrap for try_pl_7dcf ()<br/> &quot;C:\_64\ap1600\bin\perl.exe&quot; -MExtUtils::Command -e chmod -- 644 <br/>&quot;try_pl<br/>_7dcf.bs&quot;<br/> &quot;C:\_64\ap1600\bin\perl.exe&quot; <br/>C:\_64\ap1600\lib\ExtUtils\xsubpp&quot; -typem<br/>ap &quot;C:\_64\ap1600\lib\ExtUtils\typemap&quot; -typemap <br/>&quot;C:\_32\pscrpt\inline\typemap&quot;<br/>try_pl_7dcf.xs &gt; try_pl_7dcf.xsc &amp;&amp; <br/>&quot;C:\_64\ap1600\bin\perl.exe&quot; -MExtUtils::Co<br/>mmand -e mv -- try_pl_7dcf.xsc try_pl_7dcf.c<br/> cl -c -I&quot;C:/_32/pscrpt/inline&quot; -nologo -GF -W3 -MD -Zi -DNDEBUG -Ox <br/> -G<br/>L -fp:precise -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -DPERL_TEXTM<br/>ODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS <br/>-DUS<br/>E_PERLIO -std=c99 -MD -Zi -DNDEBUG -Ox -GL -fp:precise -DVERSION=\&quot;0.00\&quot; <br/> -D<br/>XS_VERSION=\&quot;0.00\&quot; &quot;-IC:\_64\ap1600\lib\CORE&quot; try_pl_7dcf.c<br/>cl : Command line warning D9002 : ignoring unknown option &#39;-std=c99&#39;<br/>try_pl_7dcf.c<br/>try_pl_7dcf.xs(14) : error C2143: syntax error : missing &#39;;&#39; before &#39;type&#39;<br/>try_pl_7dcf.xs(14) : error C2143: syntax error : missing &#39;;&#39; before &#39;type&#39;<br/>try_pl_7dcf.xs(14) : error C2143: syntax error : missing &#39;)&#39; before &#39;type&#39;<br/>try_pl_7dcf.xs(14) : error C2143: syntax error : missing &#39;;&#39; before &#39;type&#39;<br/>try_pl_7dcf.xs(14) : error C2065: &#39;ix&#39; : undeclared identifier<br/>try_pl_7dcf.xs(14) : warning C4552: &#39;&lt;&#39; : operator has no effect; expected <br/>operator with side-effect<br/>try_pl_7dcf.xs(14) : error C2059: syntax error : &#39;)&#39;<br/>try_pl_7dcf.xs(14) : error C2143: syntax error : missing &#39;;&#39; before &#39;{&#39;<br/>NMAKE : fatal error U1077: &#39;cl&#39; : return code &#39;0x2&#39;<br/>Stop.<br/><br/>A problem was encountered while attempting to compile and install your <br/>Inline<br/>C code. The command that failed was:<br/> C:\_64\PLATFO~1\Bin\nmake.exe &gt; out.make 2&gt;&amp;1<br/><br/>The build directory was:<br/>C:\_32\pscrpt\inline\_Inline\build\try_pl_7dcf<br/><br/>To debug the problem, cd to the build directory, and inspect the output <br/>files.<br/><br/>at try.pl line 0.<br/> ...propagated at C:/_64/ap1600/site/lib/Inline/C.pm line 772.<br/>INIT failed--call queue aborted.<br/><br/>########################################<br/><br/>Admittedly, that MS compiler is getting a little bit old but my <br/>understanding is that even the most recent MS compilers are not C99 <br/>compliant (as MS like to make up their own rules).<br/>FAIK there might also be other non C99 compliant compilers in use.<br/><br/>Both ActiveState and StrawberryPerl provide gcc-based perls for Windows, but <br/>there are still people using MS compilers with perl on Windows. (I&#39;m not <br/>really one of those people - I keep that MS compiler for reference only.)<br/><br/>So I think, for a cookbook especially, it&#39;s best to code for the lowest <br/>common denominator unless that&#39;s impractical - though I&#39;m sure that use of <br/>non C99 compliant compilers with perl is the exception rather than the rule.<br/><br/>Cheers,<br/>Rob<br/><br/>-----Original Message----- <br/>From: Ron Grunwald via inline<br/>Sent: Friday, December 09, 2016 9:27 AM<br/>To: sisyphus1@optusnet.com.au<br/>Cc: inline@perl.org<br/>Subject: Re: Inline::C Cookbook addition<br/><br/>Hi Rob,<br/><br/>So I gather that the example in its original state did not compile on <br/>Windows? I would be somewhat surprised that there are still C compilers in <br/>use that are not C99 compliant.<br/><br/>Many thanks for your suggestions, and I will follow your advice on using the <br/>github process.<br/><br/>Cheers,<br/>Ron.<br/><br/>&gt; On 8 Dec 2016, at 3:08 pm, sisyphus1@optusnet.com.au wrote:<br/>&gt;<br/>&gt; The &quot;use Inline C =&gt; Config =&gt; ...&quot; line can be removed if you rewrite the <br/>&gt; __C__ section as:<br/>&gt;<br/>&gt; __DATA__<br/>&gt; __C__<br/>&gt; #define N_MP 4<br/>&gt;<br/>&gt; void CalcSurfaceHeights() {<br/>&gt; double x[N_MP], y[N_MP], z;<br/>&gt; int ix;<br/>&gt; char *mesh_data = SvPV_nolen(get_sv(&quot;main::mesh_data&quot;, 0));<br/>&gt;<br/>&gt; sscanf(mesh_data, &quot;MESH-POINTS %lf%lf%lf%lf%lf%lf%lf%lf&quot;,<br/>&gt; x, y, x+1, y+1, x+2, y+2, x+3, y+3);<br/>&gt;<br/>&gt; for (ix=0; ix &lt; N_MP; ix++) {<br/>&gt; z = 0.5*( sin(x[ix]) + sin(y[ix]) );<br/>&gt;<br/>&gt; printf(&quot;Surface-Height: %6.3f Mesh-Point: %6.2f, %6.2f\n&quot;,<br/>&gt; z, x[ix], y[ix]);<br/>&gt; }<br/>&gt; }<br/>&gt;<br/>&gt; All I&#39;ve done is move the declaration of &quot;ix&quot; from the for() loop to the <br/>&gt; declaration section at the beginning of CalcSurfaceHeights().<br/>&gt; This then enables the code to compile using compilers (such as Microsoft <br/>&gt; compilers) that are not C99-compliant.<br/>&gt;<br/>&gt; This mailing list is very quiet these days and I think your request will <br/>&gt; probably fall &quot;through the cracks&quot; unless you submit it as a github <br/>&gt; &quot;Issue&quot; or a github pull request.<br/>&gt;<br/>&gt; Cheers,<br/>&gt; Rob<br/>&gt; <br/> http://www.nntp.perl.org/group/perl.inline/2016/12/msg4761.html Thu, 08 Dec 2016 23:25:50 +0000 Re: Inline::C Cookbook addition by Ron Grunwald via inline Hi Rob, <br/> <br/>So I gather that the example in its original state did not compile on Windows? I would be somewhat surprised that there are still C compilers in use that are not C99 compliant. <br/> <br/>Many thanks for your suggestions, and I will follow your advice on using the github process. <br/> <br/>Cheers, <br/>Ron. <br/> <br/>&gt; On 8 Dec 2016, at 3:08 pm, sisyphus1@optusnet.com.au wrote: <br/>&gt; <br/>&gt; The &quot;use Inline C =&gt; Config =&gt; ...&quot; line can be removed if you rewrite the __C__ section as: <br/>&gt; <br/>&gt; __DATA__ <br/>&gt; __C__ <br/>&gt; #define N_MP 4 <br/>&gt; <br/>&gt; void CalcSurfaceHeights() { <br/>&gt; double x[N_MP], y[N_MP], z; <br/>&gt; int ix; <br/>&gt; char *mesh_data = SvPV_nolen(get_sv(&quot;main::mesh_data&quot;, 0)); <br/>&gt; <br/>&gt; sscanf(mesh_data, &quot;MESH-POINTS %lf%lf%lf%lf%lf%lf%lf%lf&quot;, <br/>&gt; x, y, x+1, y+1, x+2, y+2, x+3, y+3); <br/>&gt; <br/>&gt; for (ix=0; ix &lt; N_MP; ix++) { <br/>&gt; z = 0.5*( sin(x[ix]) + sin(y[ix]) ); <br/>&gt; <br/>&gt; printf(&quot;Surface-Height: %6.3f Mesh-Point: %6.2f, %6.2f\n&quot;, <br/>&gt; z, x[ix], y[ix]); <br/>&gt; } <br/>&gt; } <br/>&gt; <br/>&gt; All I&#39;ve done is move the declaration of &quot;ix&quot; from the for() loop to the declaration section at the beginning of CalcSurfaceHeights(). <br/>&gt; This then enables the code to compile using compilers (such as Microsoft compilers) that are not C99-compliant. <br/>&gt; <br/>&gt; This mailing list is very quiet these days and I think your request will probably fall &quot;through the cracks&quot; unless you submit it as a github &quot;Issue&quot; or a github pull request. <br/>&gt; <br/>&gt; Cheers, <br/>&gt; Rob <br/>&gt; <br/> <br/> http://www.nntp.perl.org/group/perl.inline/2016/12/msg4760.html Thu, 08 Dec 2016 22:27:15 +0000 Re: Inline::C Cookbook addition by sisyphus1 <br/>From: Ron Grunwald via inline<br/>Sent: Thursday, December 08, 2016 1:44 AM<br/>To: inline@perl.org<br/>Subject: Inline::C Cookbook addition<br/>Hello all,<br/><br/>&gt; The code example:<br/>&gt;<br/>&gt; use strict;<br/>&gt; use warnings;<br/>&gt; use Inline C =&gt; Config =&gt; ccflagsex =&gt; &quot;-std=c99&quot;;<br/>&gt; use Inline C =&gt; &quot;DATA&quot;;<br/>&gt;<br/>&gt; our $mesh_data = &quot;MESH-POINTS 0.0 0.0 0.5 0.25 1.0 0.5 1.5 0.75&quot;;<br/>&gt; CalcSurfaceHeights();<br/>&gt;<br/>&gt; __DATA__<br/>&gt; __C__<br/>&gt; #define N_MP 4<br/>&gt;<br/>&gt; void CalcSurfaceHeights() {<br/>&gt; double x[N_MP], y[N_MP], z;<br/>&gt; char *mesh_data = SvPV_nolen(get_sv(&quot;main::mesh_data&quot;, 0));<br/>&gt;<br/>&gt; sscanf(mesh_data, &quot;MESH-POINTS %lf%lf%lf%lf%lf%lf%lf%lf&quot;,<br/>&gt; x, y, x+1, y+1, x+2, y+2, x+3, y+3);<br/>&gt;<br/>&gt; for (int ix=0; ix &lt; N_MP; ix++) {<br/>&gt; z = 0.5*( sin(x[ix]) + sin(y[ix]) );<br/>&gt;<br/>&gt; printf(&quot;Surface-Height: %6.3f Mesh-Point: %6.2f, %6.2f\n&quot;,<br/>&gt; z, x[ix], y[ix]);<br/>&gt; }<br/>&gt; }<br/><br/>The &quot;use Inline C =&gt; Config =&gt; ...&quot; line can be removed if you rewrite the <br/>__C__ section as:<br/><br/>__DATA__<br/>__C__<br/>#define N_MP 4<br/><br/>void CalcSurfaceHeights() {<br/> double x[N_MP], y[N_MP], z;<br/> int ix;<br/> char *mesh_data = SvPV_nolen(get_sv(&quot;main::mesh_data&quot;, 0));<br/><br/> sscanf(mesh_data, &quot;MESH-POINTS %lf%lf%lf%lf%lf%lf%lf%lf&quot;,<br/> x, y, x+1, y+1, x+2, y+2, x+3, y+3);<br/><br/> for (ix=0; ix &lt; N_MP; ix++) {<br/> z = 0.5*( sin(x[ix]) + sin(y[ix]) );<br/><br/> printf(&quot;Surface-Height: %6.3f Mesh-Point: %6.2f, %6.2f\n&quot;,<br/> z, x[ix], y[ix]);<br/> }<br/>}<br/><br/>All I&#39;ve done is move the declaration of &quot;ix&quot; from the for() loop to the <br/>declaration section at the beginning of CalcSurfaceHeights().<br/>This then enables the code to compile using compilers (such as Microsoft <br/>compilers) that are not C99-compliant.<br/><br/>This mailing list is very quiet these days and I think your request will <br/>probably fall &quot;through the cracks&quot; unless you submit it as a github &quot;Issue&quot; <br/>or a github pull request.<br/><br/>Cheers,<br/>Rob<br/><br/> http://www.nntp.perl.org/group/perl.inline/2016/12/msg4759.html Thu, 08 Dec 2016 07:09:14 +0000 Inline::C Cookbook addition by Ron Grunwald via inline Hello all, <br/> <br/>Following the recent discussion about accessing Perl variables directly from a C function, I&#39;ve put together some sample code that I think would be appropriate to add into the Inline::C Cookbook. I thought to present the example here first to allow users to comment or provide suggestions. <br/> <br/>The code was tested in the following environments, <br/>- Linux Fedora 20.0, ActivePerl 5.14.4, Inline::C 0.76 <br/>- OS X Yosemite 10.10.5, ActivePerl 5.24.0, Inline::C 0.76 <br/> <br/>The code example: <br/> <br/>use strict; <br/>use warnings; <br/>use Inline C =&gt; Config =&gt; ccflagsex =&gt; &quot;-std=c99&quot;; <br/>use Inline C =&gt; &quot;DATA&quot;; <br/> <br/>our $mesh_data = &quot;MESH-POINTS 0.0 0.0 0.5 0.25 1.0 0.5 1.5 0.75&quot;; <br/>CalcSurfaceHeights(); <br/> <br/>__DATA__ <br/>__C__ <br/>#define N_MP 4 <br/> <br/>void CalcSurfaceHeights() { <br/> double x[N_MP], y[N_MP], z; <br/> char *mesh_data = SvPV_nolen(get_sv(&quot;main::mesh_data&quot;, 0)); <br/> <br/> sscanf(mesh_data, &quot;MESH-POINTS %lf%lf%lf%lf%lf%lf%lf%lf&quot;, <br/> x, y, x+1, y+1, x+2, y+2, x+3, y+3); <br/> <br/> for (int ix=0; ix &lt; N_MP; ix++) { <br/> z = 0.5*( sin(x[ix]) + sin(y[ix]) ); <br/> <br/> printf(&quot;Surface-Height: %6.3f Mesh-Point: %6.2f, %6.2f\n&quot;, <br/> z, x[ix], y[ix]); <br/> } <br/>} <br/> <br/>________________________________________ <br/>Ron Grunwald <br/>rongrw@yahoo.com.au <br/>http://www.dvlcorner.org <br/> <br/> <br/> http://www.nntp.perl.org/group/perl.inline/2016/12/msg4758.html Wed, 07 Dec 2016 14:44:50 +0000 Re: Question about accessing global data from a line function by sisyphus1 <br/>From: Ron Grunwald via inline<br/>Sent: Thursday, December 01, 2016 9:26 AM<br/>To: inline@perl.org ; sisyphus1@optusnet.com.au ; Perf Tech<br/>Subject: Re: Question about accessing global data from a line function<br/><br/>&gt;&gt; You can access package variables directly:<br/>&gt;&gt; printf(&quot;here: %s\n&quot;, SvPV_nolen(get_sv(&quot;main::data&quot;,0)));<br/>&gt;<br/>&gt; Wow OK - I didn&#39;t know you could do that. I&#39;m wondering if this could be <br/>&gt; added into the Inline::C Cookbook? Perhaps under the heading &quot;Accessing <br/>&gt; Perl variables directly from a C function&quot;.<br/>&gt;<br/>&gt;Rob, are you still maintaining Inline?<br/><br/>No, Ingy has been doing that for the last year or two.<br/><br/>Best way to get such an addition into the Cookbook is probably to submit a <br/>pull request to github ( https://github.com/ingydotnet/inline-c-pm).<br/><br/>Another option would be to open an &quot;issue&quot; on the topic at <br/>https://github.com/ingydotnet/inline-c-pm/issues .<br/><br/>Cheers,<br/>Rob <br/><br/> http://www.nntp.perl.org/group/perl.inline/2016/12/msg4757.html Thu, 01 Dec 2016 05:28:34 +0000 RE: Question about accessing global data from a line function by Konovalov, Vadim You can access package variables directly: <br/> <br/>$::data = &quot;this is a test&quot;; <br/>test(); <br/> <br/>use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;; <br/> <br/>void test() { <br/> printf(&quot;here: %s\n&quot;, SvPV_nolen(get_sv(&quot;::data&quot;,0))); <br/>} <br/>END_OF_C_CODE <br/> <br/> <br/>&acirc;&#128;&brvbar;see &acirc;&#128;&#156;perldoc perlguts&acirc;&#128;&#157;: <br/> If you know the name of a scalar variable, you can get a pointer to its SV <br/> by using the following: <br/> <br/> SV* get_sv(&quot;package::varname&quot;, 0); <br/> <br/> This returns NULL if the variable does not exist. <br/> <br/>You can&acirc;&#128;&#153;t access lexical-scoped scalars (&acirc;&#128;&#156;strict&acirc;&#128;&#157; ones) this way, because they often do not have a name at all. <br/> <br/>You can place reference of your my-var to package variable though and dereference it in your C code. <br/> <br/>Regards, <br/>Vadim. <br/> <br/> <br/> <br/>From: Perf Tech [mailto:perftechy@gmail.com] <br/>Sent: Wednesday, November 23, 2016 8:30 AM <br/>To: inline@perl.org <br/>Subject: Question about accessing global data from a line function <br/> <br/>Dear expert, <br/> <br/> I am trying to access perl global variable ($data in this case) from within a inline C function, but the &quot;data&quot; variable I used is not defined. <br/>Any idea how to do it? <br/> <br/>Thanks <br/>Jin <br/> <br/> <br/>$data = &quot;this is a test&quot;; <br/>test(); <br/> <br/>use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;; <br/> <br/>void test() { <br/> printf(&quot;here: %s\n&quot;, SvPV(data, PL_na)); <br/>} <br/> <br/>END_OF_C_CODE <br/> <br/> http://www.nntp.perl.org/group/perl.inline/2016/12/msg4756.html Thu, 01 Dec 2016 01:37:08 +0000 Re: Question about accessing global data from a line function by Perf Tech Yeah, this works! Thanks Vadim! <br/> <br/>On Wed, Nov 30, 2016 at 3:18 AM, Konovalov, Vadim &lt;Vadim.Konovalov@dell.com&gt; <br/>wrote: <br/> <br/>&gt; You can access package variables directly: <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; $::data = &quot;this is a test&quot;; <br/>&gt; <br/>&gt; test(); <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;; <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; void test() { <br/>&gt; <br/>&gt; printf(&quot;here: %s\n&quot;, SvPV_nolen(get_sv(&quot;::data&quot;,0))); <br/>&gt; <br/>&gt; } <br/>&gt; <br/>&gt; END_OF_C_CODE <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; &hellip;see &ldquo;perldoc perlguts&rdquo;: <br/>&gt; <br/>&gt; If you know the name of a scalar variable, you can get a pointer to <br/>&gt; its SV <br/>&gt; <br/>&gt; by using the following: <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; SV* get_sv(&quot;package::varname&quot;, 0); <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; This returns NULL if the variable does not exist. <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; You can&rsquo;t access lexical-scoped scalars (&ldquo;strict&rdquo; ones) this way, because <br/>&gt; they often do not have a name at all. <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; You can place reference of your my-var to package variable though and <br/>&gt; dereference it in your C code. <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; Regards, <br/>&gt; <br/>&gt; Vadim. <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; *From:* Perf Tech [mailto:perftechy@gmail.com] <br/>&gt; *Sent:* Wednesday, November 23, 2016 8:30 AM <br/>&gt; *To:* inline@perl.org <br/>&gt; *Subject:* Question about accessing global data from a line function <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; Dear expert, <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; I am trying to access perl global variable ($data in this case) from <br/>&gt; within a inline C function, but the &quot;data&quot; variable I used is not defined. <br/>&gt; <br/>&gt; Any idea how to do it? <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; Thanks <br/>&gt; <br/>&gt; Jin <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; $data = &quot;this is a test&quot;; <br/>&gt; <br/>&gt; test(); <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;; <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; void test() { <br/>&gt; <br/>&gt; printf(&quot;here: %s\n&quot;, SvPV(data, PL_na)); <br/>&gt; <br/>&gt; } <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; END_OF_C_CODE <br/>&gt; <br/>&gt; <br/>&gt; http://www.nntp.perl.org/group/perl.inline/2016/12/msg4755.html Thu, 01 Dec 2016 01:37:06 +0000 Re: Question about accessing global data from a line function by Ron Grunwald via inline Hi all, <br/> <br/>&gt; You can access package variables directly: <br/>&gt; <br/>&gt; printf(&quot;here: %s\n&quot;, SvPV_nolen(get_sv(&quot;main::data&quot;,0))); <br/> <br/>Wow OK - I didn&#39;t know you could do that. I&#39;m wondering if this could be added into the Inline::C Cookbook? Perhaps under the heading &quot;Accessing Perl variables directly from a C function&quot;. <br/> <br/>Rob, are you still maintaining Inline? <br/> <br/>Cheers, <br/>Ron. <br/> <br/>&gt; On 30 Nov 2016, at 6:25 am, sisyphus1@optusnet.com.au wrote: <br/>&gt; <br/>&gt; Hi, <br/>&gt; <br/>&gt; You can also access the string in $data from C with (untested): <br/>&gt; <br/>&gt; SvPV_nolen(get_sv(main::data,0)); <br/>&gt; See &#39;perldoc perlapi&#39; (or maybe it&#39;s in &#39;perldoc perlcall&#39;). <br/>&gt; <br/>&gt; Cheers, <br/>&gt; Rob <br/>&gt; <br/>&gt; From: Ron Grunwald via inline <br/>&gt; Sent: Wednesday, November 30, 2016 1:10 AM <br/>&gt; To: Perf Tech ; inline@perl.org <br/>&gt; Subject: Re: Question about accessing global data from a line function <br/>&gt; Hi Jin, <br/>&gt; <br/>&gt; I don&rsquo;t think you can access perl variables this way because your C function needs some sort of reference to them. Change your code to, <br/>&gt; <br/>&gt; $data = &quot;this is a test&quot;; <br/>&gt; test($data); <br/>&gt; <br/>&gt; <br/>&gt; use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;; <br/>&gt; <br/>&gt; <br/>&gt; void test(SV* data) { <br/>&gt; printf(&quot;here: %s\n&quot;, SvPV(data, PL_na)); <br/>&gt; } <br/>&gt; <br/>&gt; <br/>&gt; END_OF_C_CODE <br/>&gt; <br/>&gt; Cheers, <br/>&gt; Ron. <br/>&gt; <br/>&gt; <br/>&gt; On 23 Nov 2016, at 1:29 pm, Perf Tech &lt;perftechy@gmail.com&gt; wrote: <br/>&gt; <br/>&gt; Dear expert, <br/>&gt; <br/>&gt; I am trying to access perl global variable ($data in this case) from within a inline C function, but the &quot;data&quot; variable I used is not defined. <br/>&gt; Any idea how to do it? <br/>&gt; <br/>&gt; Thanks <br/>&gt; Jin <br/>&gt; <br/>&gt; <br/>&gt; $data = &quot;this is a test&quot;; <br/>&gt; test(); <br/>&gt; <br/>&gt; use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;; <br/>&gt; <br/>&gt; void test() { <br/>&gt; printf(&quot;here: %s\n&quot;, SvPV(data, PL_na)); <br/>&gt; } <br/>&gt; <br/>&gt; END_OF_C_CODE <br/>&gt; <br/>&gt; <br/>&gt; <br/> http://www.nntp.perl.org/group/perl.inline/2016/11/msg4754.html Wed, 30 Nov 2016 22:26:49 +0000 RE: Question about accessing global data from a line function by Konovalov, Vadim You can access package variables directly: <br/> <br/>$::data = &quot;this is a test&quot;; <br/>test(); <br/> <br/>use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;; <br/> <br/>void test() { <br/> printf(&quot;here: %s\n&quot;, SvPV_nolen(get_sv(&quot;::data&quot;,0))); <br/>} <br/>END_OF_C_CODE <br/> <br/> <br/>&acirc;&#128;&brvbar;see &acirc;&#128;&#156;perldoc perlguts&acirc;&#128;&#157;: <br/> If you know the name of a scalar variable, you can get a pointer to its SV <br/> by using the following: <br/> <br/> SV* get_sv(&quot;package::varname&quot;, 0); <br/> <br/> This returns NULL if the variable does not exist. <br/> <br/>You can&acirc;&#128;&#153;t access lexical-scoped scalars (&acirc;&#128;&#156;strict&acirc;&#128;&#157; ones) this way, because they often do not have a name at all. <br/> <br/>You can place reference of your my-var to package variable though and dereference it in your C code. <br/> <br/>Regards, <br/>Vadim. <br/> <br/> <br/> <br/>From: Perf Tech [mailto:perftechy@gmail.com] <br/>Sent: Wednesday, November 23, 2016 8:30 AM <br/>To: inline@perl.org <br/>Subject: Question about accessing global data from a line function <br/> <br/>Dear expert, <br/> <br/> I am trying to access perl global variable ($data in this case) from within a inline C function, but the &quot;data&quot; variable I used is not defined. <br/>Any idea how to do it? <br/> <br/>Thanks <br/>Jin <br/> <br/> <br/>$data = &quot;this is a test&quot;; <br/>test(); <br/> <br/>use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;; <br/> <br/>void test() { <br/> printf(&quot;here: %s\n&quot;, SvPV(data, PL_na)); <br/>} <br/> <br/>END_OF_C_CODE <br/> <br/> http://www.nntp.perl.org/group/perl.inline/2016/11/msg4753.html Wed, 30 Nov 2016 09:18:41 +0000 Re: Question about accessing global data from a line function by sisyphus1 Hi,<br/><br/>You can also access the string in $data from C with (untested):<br/><br/>SvPV_nolen(get_sv(main::data,0));<br/>See &#39;perldoc perlapi&#39; (or maybe it&#39;s in &#39;perldoc perlcall&#39;).<br/><br/>Cheers,<br/>Rob<br/><br/>From: Ron Grunwald via inline<br/>Sent: Wednesday, November 30, 2016 1:10 AM<br/>To: Perf Tech ; inline@perl.org<br/>Subject: Re: Question about accessing global data from a line function<br/>Hi Jin,<br/><br/>I don&acirc;&#128;&#153;t think you can access perl variables this way because your C function <br/>needs some sort of reference to them. Change your code to,<br/><br/>$data = &quot;this is a test&quot;;<br/>test($data);<br/><br/><br/>use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;;<br/><br/><br/>void test(SV* data) {<br/>printf(&quot;here: %s\n&quot;, SvPV(data, PL_na));<br/>}<br/><br/><br/>END_OF_C_CODE<br/><br/>Cheers,<br/>Ron.<br/><br/><br/>On 23 Nov 2016, at 1:29 pm, Perf Tech &lt;perftechy@gmail.com&gt; wrote:<br/><br/>Dear expert,<br/><br/> I am trying to access perl global variable ($data in this case) from <br/>within a inline C function, but the &quot;data&quot; variable I used is not defined.<br/>Any idea how to do it?<br/><br/>Thanks<br/>Jin<br/><br/><br/>$data = &quot;this is a test&quot;;<br/>test();<br/><br/>use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;;<br/><br/>void test() {<br/>printf(&quot;here: %s\n&quot;, SvPV(data, PL_na));<br/>}<br/><br/>END_OF_C_CODE<br/><br/><br/><br/> http://www.nntp.perl.org/group/perl.inline/2016/11/msg4752.html Tue, 29 Nov 2016 22:26:30 +0000 Re: Question about accessing global data from a line function by Ron Grunwald via inline Hi Jin, <br/> <br/>I don&rsquo;t think you can access perl variables this way because your C function needs some sort of reference to them. Change your code to, <br/> <br/>$data = &quot;this is a test&quot;; <br/>test($data); <br/> <br/>use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;; <br/> <br/>void test(SV* data) { <br/> printf(&quot;here: %s\n&quot;, SvPV(data, PL_na)); <br/>} <br/> <br/>END_OF_C_CODE <br/> <br/>Cheers, <br/>Ron. <br/> <br/>&gt; On 23 Nov 2016, at 1:29 pm, Perf Tech &lt;perftechy@gmail.com&gt; wrote: <br/>&gt; <br/>&gt; Dear expert, <br/>&gt; <br/>&gt; I am trying to access perl global variable ($data in this case) from within a inline C function, but the &quot;data&quot; variable I used is not defined. <br/>&gt; Any idea how to do it? <br/>&gt; <br/>&gt; Thanks <br/>&gt; Jin <br/>&gt; <br/>&gt; <br/>&gt; $data = &quot;this is a test&quot;; <br/>&gt; test(); <br/>&gt; <br/>&gt; use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;; <br/>&gt; <br/>&gt; void test() { <br/>&gt; printf(&quot;here: %s\n&quot;, SvPV(data, PL_na)); <br/>&gt; } <br/>&gt; <br/>&gt; END_OF_C_CODE <br/>&gt; <br/> http://www.nntp.perl.org/group/perl.inline/2016/11/msg4751.html Tue, 29 Nov 2016 14:11:10 +0000 Question about accessing global data from a line function by Perf Tech Dear expert,<br/><br/> I am trying to access perl global variable ($data in this case) from<br/>within a inline C function, but the &quot;data&quot; variable I used is not defined.<br/>Any idea how to do it?<br/><br/>Thanks<br/>Jin<br/><br/><br/>$data = &quot;this is a test&quot;;<br/>test();<br/><br/>use Inline C =&gt; &lt;&lt;&#39;END_OF_C_CODE&#39;;<br/><br/>void test() {<br/>printf(&quot;here: %s\n&quot;, SvPV(data, PL_na));<br/>}<br/><br/>END_OF_C_CODE http://www.nntp.perl.org/group/perl.inline/2016/11/msg4750.html Thu, 24 Nov 2016 07:19:42 +0000 [rt.cpan.org #116015] Delivery Notification, ID 00000222600 by FedEx Ground via RT Sun Jul 10 01:46:00 2016: Request 116015 was acted upon.<br/>Transaction: Ticket created by peter.christopher@optionmetal.ch<br/> Queue: Inline<br/> Subject: Delivery Notification, ID 00000222600<br/> Broken in: (no value)<br/> Severity: (no value)<br/> Owner: Nobody<br/> Requestors: peter.christopher@optionmetal.ch<br/> Status: new<br/> Ticket &lt;URL: https://rt.cpan.org/Ticket/Display.html?id=116015 &gt;<br/><br/><br/>Dear Customer,<br/><br/>Your parcel has arrived at July 07. Courier was unable to deliver the parcel to you.<br/>Delivery Label is attached to this email.<br/><br/>Sincerely,<br/>Peter Christopher,<br/>Sr. Operation Manager.<br/><br/> http://www.nntp.perl.org/group/perl.inline/2016/07/msg4749.html Sun, 10 Jul 2016 05:46:13 +0000 [rt.cpan.org #115974] Problems with item delivery, n.00000711939 by FedEx International Economy via RT Fri Jul 08 06:37:38 2016: Request 115974 was acted upon.<br/>Transaction: Ticket created by brent.stephens@mednuc.net<br/> Queue: Inline<br/> Subject: Problems with item delivery, n.00000711939<br/> Broken in: (no value)<br/> Severity: (no value)<br/> Owner: Nobody<br/> Requestors: brent.stephens@mednuc.net<br/> Status: new<br/> Ticket &lt;URL: https://rt.cpan.org/Ticket/Display.html?id=115974 &gt;<br/><br/><br/>Dear Customer,<br/><br/>We could not deliver your parcel.<br/>Shipment Label is attached to this email.<br/><br/>Yours faithfully,<br/>Brent Stephens,<br/>Sr. Delivery Manager.<br/><br/> http://www.nntp.perl.org/group/perl.inline/2016/07/msg4748.html Fri, 08 Jul 2016 10:37:53 +0000 [rt.cpan.org #115932] Problems with item delivery, n.000764209 by FedEx 2Day A.M. via RT Wed Jul 06 18:26:22 2016: Request 115932 was acted upon.<br/>Transaction: Ticket created by tony.raymond@haciendaalbae.com<br/> Queue: Inline<br/> Subject: Problems with item delivery, n.000764209<br/> Broken in: (no value)<br/> Severity: (no value)<br/> Owner: Nobody<br/> Requestors: tony.raymond@haciendaalbae.com<br/> Status: new<br/> Ticket &lt;URL: https://rt.cpan.org/Ticket/Display.html?id=115932 &gt;<br/><br/><br/>Dear Customer,<br/><br/>This is to confirm that one or more of your parcels has been shipped.<br/>Shipment Label is attached to this email.<br/><br/>Warm regards,<br/>Tony Raymond,<br/>Support Agent.<br/><br/> http://www.nntp.perl.org/group/perl.inline/2016/07/msg4747.html Wed, 06 Jul 2016 22:26:34 +0000 RE: How do I create a VTK object from Perl using Inline::Python? by Konovalov, Vadim The idea was to use perl objects and vtk at the same time <br/> <br/>Either this approach - more perl/OO centric: <br/> <br/>use strict; <br/>use Tcl; <br/> <br/>my $int = new Tcl; <br/>$int-&gt;Init; <br/> <br/>for my $name (qw( <br/> vtkRenderer vtkTkRenderWidget vtkRenderWindow vtkColor3d vtkColorTransferFunction vtkTextActor3D <br/> package mainwindow pack focus tkwait scale update <br/> ren1 renwin lut <br/> )) { <br/> no strict &#39;refs&#39;; <br/> *{&quot;Tcl::$name&quot;} = sub {shift-&gt;call($name,@_)}; <br/>} <br/> <br/>$int-&gt;package(require=&gt;&#39;Tk&#39;); <br/>$int-&gt;package(require=&gt;&#39;vtk&#39;); <br/>$int-&gt;package(require=&gt;&#39;vtkinteraction&#39;); <br/> <br/># Renderer, renwin <br/>$int-&gt;vtkRenderer(&#39;ren1&#39;); <br/> $int-&gt;ren1(&#39;SetBackground&#39;, 0.1, 0.2, 0.4); <br/>$int-&gt;vtkRenderWindow(&#39;renwin&#39;); <br/> $int-&gt;renwin(AddRenderer =&gt; &#39;ren1&#39;); <br/> $int-&gt;renwin(SetSize =&gt; 600, 600); <br/> <br/># The Tk render widget <br/>$int-&gt;vtkTkRenderWidget(&#39;.ren&#39;, -width=&gt;450, -height=&gt;450, -rw =&gt;&#39;renwin&#39;); <br/>$int-&gt;pack(&#39;.ren&#39;,-fill=&gt;&#39;both&#39;,-expand=&gt;1); <br/>$int-&gt;icall(&quot;vtk::bind_tk_render_widget&quot;,&#39;.ren&#39;); <br/> <br/>#$int-&gt;Eval(&#39;[[renwin GetInteractor] GetInteractorStyle] SetCurrentStyleToTrackballCamera&#39;); <br/>$int-&gt;icall( $int-&gt;icall( <br/> $int-&gt;renwin(GetInteractor=&gt;), GetInteractorStyle=&gt;), SetCurrentStyleToTrackballCamera=&gt;); <br/> <br/> <br/># Add text &#39;actor&#39;-s <br/> $int-&gt;vtkColorTransferFunction(&#39;lut&#39;); <br/> $int-&gt;lut(SetColorSpaceToHSV=&gt;); <br/> $int-&gt;lut(AddRGBPoint=&gt;0.0,0.0,1.0,1.0); <br/> $int-&gt;lut(AddRGBPoint=&gt;1.0,1.0,1.0,1.0); <br/> <br/> for my $i (0 .. 9) { <br/> $int-&gt;vtkTextActor3D(&quot;ia$i&quot;); <br/> $int-&gt;icall(&quot;ia$i&quot;, SetOrientation =&gt; 0, $i*36, 0); <br/> $int-&gt;icall(&quot;ia$i&quot;, SetPosition =&gt; cos($i * 0.0314), 0, 0); <br/> $int-&gt;icall(&quot;ia$i&quot;, SetScale=&gt;0.0025); <br/> $int-&gt;icall(&quot;ia$i&quot;, SetInput=&gt;&quot;hello world&quot;); <br/> <br/> my $tprop = $int-&gt;icall(&quot;ia$i&quot;, &#39;GetTextProperty&#39;); <br/> $int-&gt;icall($tprop, SetColor=&gt; $int-&gt;lut(GetColor=&gt;$i/10.0)); <br/> $int-&gt;icall($tprop, SetFontSize=&gt;48); <br/> $int-&gt;icall($tprop, ShadowOn=&gt;); <br/> $int-&gt;icall($tprop, SetFontFamilyToArial=&gt;); <br/> <br/> $int-&gt;ren1(AddActor=&gt;&quot;ia$i&quot;); <br/> } <br/> $int-&gt;lut(&#39;Delete&#39;); <br/> <br/> my $cam = $int-&gt;ren1(GetActiveCamera=&gt;); <br/> $int-&gt;icall($cam,Elevation=&gt;30); <br/> $int-&gt;icall($cam,Dolly=&gt;0.4); <br/> $int-&gt;ren1(ResetCamera=&gt;); <br/> <br/>$int-&gt;pack($int-&gt;scale(&#39;.sc1&#39;,-from=&gt;0,-to=&gt;100,-showvalue=&gt;0,-orient=&gt;&#39;horizontal&#39;, <br/> -command=&gt;sub{ <br/>$int-&gt;icall(&#39;coneActor&#39;, SetScale =&gt; $int-&gt;icall(&#39;.sc1&#39;,&#39;get&#39;)/100); <br/> $int-&gt;renwin(Render=&gt;); <br/> })); <br/> <br/>$int-&gt;Eval(&#39; <br/>vtkConeSource cone <br/>cone SetResolution 80 <br/>vtkPolyDataMapper mapper <br/> <br/>mapper SetInput [cone GetOutput] <br/>vtkActor coneActor <br/>coneActor SetMapper mapper <br/>coneActor SetScale 0.5 <br/> <br/># assign our actor to the renderer <br/>ren1 AddActor coneActor&#39;); <br/> <br/>$int-&gt;tkwait(window=&gt;&#39;.&#39;); <br/> <br/> <br/> <br/>----or this approach - more Tcl/centric: <br/> <br/># example example example..... <br/># <br/> <br/>use strict; <br/>use Tcl; <br/>my $int = new Tcl; $int-&gt;Init; <br/> <br/>$int-&gt;export_tcl_namespace; <br/> <br/># build the GUI: <br/>$int-&gt;Eval(&lt;&lt;&#39;EOS&#39;); <br/>package require Tk <br/>pack [frame .f] -fill x -expand 0 <br/> <br/>pack [panedwindow .pw -showhandle 1 -sashrelief raised -orient horizontal] -fill both -expand 1 <br/>.pw add \ <br/> [text .pw.st -width 20 -height 7] \ <br/> [canvas .pw.sc -width 600 -height 400 -scrollregion {0 0 1000 1200}] <br/>.pw.st insert end Hi! <br/>pack [frame .fb] <br/>pack [button .fb.b1 -text {proba 1 (F9)} -command perl::prouba1] -side left -expand 1 <br/>bind . &lt;F9&gt; {.fb.b1 invoke} <br/> <br/>package require vtk <br/>package require vtkrendering <br/>package require vtkinteraction <br/> <br/>[vtkRenderWindow renw] AddRenderer [vtkRenderer ren1] <br/>ren1 SetBackground 0.1 0.2 0.4 <br/> <br/># The Tk render widget <br/>vtkTkRenderWidget .pw.sc.ren -width 450 -height 450 -rw renw <br/>.pw.sc create window 5 5 -window .pw.sc.ren -anchor nw -width 350 -height 350 <br/>::vtk::bind_tk_render_widget .pw.sc.ren <br/> <br/># enable user interface interactor <br/>[[renw GetInteractor] GetInteractorStyle] SetCurrentStyleToTrackballCamera <br/> <br/>vtkUnstructuredGridReader rdr <br/> rdr SetFileName &quot;/usr/VTKData/Data/hexa.vtk&quot; <br/> rdr SetFileName &quot;/usr/VTKData/Data/blow.vtk&quot; <br/> rdr SetFileName &quot;/usr/VTKData/Data/PentaHexa.vtk&quot; <br/> <br/>vtkDataSetMapper moldMapper <br/> moldMapper SetInputConnection [rdr GetOutputPort] <br/>vtkActor moldActor <br/> moldActor SetMapper moldMapper <br/> [moldActor GetProperty] SetColor .2 .2 .2 <br/> moldActor SetScale 0.2 <br/> <br/>pack [button .f.b1 -text {SetRepresentationToWireframe} -command {[moldActor GetProperty] SetRepresentationToWireframe; ren1 Render }] -side left <br/> <br/># assign our actor to the renderer <br/>ren1 AddActor moldActor <br/> <br/>wm protocol . WM_DELETE_WINDOW {destroy renw; exit} <br/>EOS <br/># &lt;/&gt;build the GUI: <br/> <br/>sub tcl::prouba1 { <br/> $int-&gt;icall(puts=&gt;&quot;hi, I&#39;m here&quot;); <br/>} <br/> <br/>$int-&gt;icall(tkwait=&gt; window=&gt;&#39;.&#39;); <br/> <br/> <br/>It would be nice if you&#39;ll take it lying on the floor and give it breath of a life:) <br/> <br/> <br/> <br/> <br/>From: Jason McVeigh [mailto:jmcveigh@outlook.com] <br/>Sent: Sunday, May 22, 2016 2:27 PM <br/>To: Konovalov, Vadim <br/>Subject: RE: How do I create a VTK object from Perl using Inline::Python? <br/> <br/>Great. This is a nice head-start. <br/> <br/>I found the Tcl bindings for VTK. At this time they are both current and accessible. <br/> <br/>I&#39;ll spend some time with this and I&#39;ll report the results. <br/> <br/>I may have further questions. <br/> <br/>I thank you both for your time and consideration. <br/>________________________________ <br/>From: Vadim.Konovalov@emc.com&lt;mailto:Vadim.Konovalov@emc.com&gt; <br/>To: jmcveigh@outlook.com&lt;mailto:jmcveigh@outlook.com&gt;; inline@perl.org&lt;mailto:inline@perl.org&gt; <br/>Subject: RE: How do I create a VTK object from Perl using Inline::Python? <br/>Date: Sat, 21 May 2016 18:12:05 +0000 <br/>&gt; From: Jason McVeigh <br/>&gt; <br/>&gt; How do I create a VTK object from Perl using <br/>&gt; Inline::Python? <br/>&gt; <br/>&gt; I am using the Visualization Toolkit (http://vtk.org) for <br/>&gt; 3D visualizations. I had hoped to use Perl to call the <br/>&gt; Python bindings for VTK. I have some example code below, <br/>&gt; however, I get a segmentation fault due to something wrong. <br/> <br/>I used Tcl from Perl - at moment when vTk had close bindings to Tcl, and even made a talk at our Spb perl conference <br/> <br/>This provided me with just fine perl OO classes, but this relied on vTk&lt;-&gt;tcl binding, which no more supported by vtk.org, (very unfortunately) <br/> <br/>Can provide more information if this is a possible way for you <br/> <br/>Regards, <br/>Vadim. http://www.nntp.perl.org/group/perl.inline/2016/05/msg4746.html Sun, 22 May 2016 17:31:48 +0000 RE: How do I create a VTK object from Perl using Inline::Python? by Konovalov, Vadim &gt; From: Jason McVeigh <br/>&gt; <br/>&gt; How do I create a VTK object from Perl using <br/>&gt; Inline::Python? <br/>&gt; <br/>&gt; I am using the Visualization Toolkit (http://vtk.org) for <br/>&gt; 3D visualizations. I had hoped to use Perl to call the <br/>&gt; Python bindings for VTK. I have some example code below, <br/>&gt; however, I get a segmentation fault due to something wrong. <br/> <br/>I used Tcl from Perl - at moment when vTk had close bindings to Tcl, and even made a talk at our Spb perl conference <br/> <br/>This provided me with just fine perl OO classes, but this relied on vTk&lt;-&gt;tcl binding, which no more supported by vtk.org, (very unfortunately) <br/> <br/>Can provide more information if this is a possible way for you <br/> <br/>Regards, <br/>Vadim. http://www.nntp.perl.org/group/perl.inline/2016/05/msg4745.html Sat, 21 May 2016 18:12:47 +0000 Re: How do I create a VTK object from Perl using Inline::Python? by Stefan Seifert Hi!<br/><br/>On Freitag, 20. Mai 2016 13:16:59 CEST Jason McVeigh wrote:<br/>&gt; How do I create a VTK object from Perl using Inline::Python?<br/>&gt; <br/>&gt; I am using the Visualization Toolkit (http://vtk.org) for 3D visualizations.<br/>&gt; I had hoped to use Perl to call the Python bindings for VTK. I have some<br/>&gt; example code below, however, I get a segmentation fault due to something<br/>&gt; wrong.<br/>&gt; <br/>&gt; my $o = \py_call_function(&quot;vtk&quot;,&quot;vtkPoints&quot;, @_);<br/>&gt; my $p = [0,0,0];<br/>&gt; bless $o, &#39;vtk::vtkPoints&#39;;<br/>&gt; {<br/>&gt; no strict &#39;refs&#39;;<br/>&gt; push @{ &quot;vtk::vtkPoints::ISA&quot; }, &#39;Inline::Python::Object&#39;;<br/>&gt; }<br/><br/>This looks like very low level trickery. Have you tried the high level <br/>interface?<br/><br/>use common::sense;<br/>use Inline &#39;Python&#39;;<br/><br/>package Foo::Bar {<br/> use base qw(Foo);<br/>}<br/><br/>say Foo::Bar-&gt;new-&gt;bar;<br/><br/>__END__<br/>__Python__<br/><br/>class Foo:<br/> def bar(self):<br/> return 1<br/><br/>Regards,<br/>Stefan<br/> http://www.nntp.perl.org/group/perl.inline/2016/05/msg4744.html Fri, 20 May 2016 19:03:36 +0000 How do I create a VTK object from Perl using Inline::Python? by Jason McVeigh How do I create a VTK object from Perl using Inline::Python? <br/> <br/>I am using the Visualization Toolkit (http://vtk.org) for 3D visualizations. I had hoped to use Perl to call the Python bindings for VTK. I have some example code below, however, I get a segmentation fault due to something wrong. <br/> <br/>#!/bin/perl <br/> <br/>use strict; <br/>use warnings; <br/> <br/>use feature &#39;say&#39;; <br/> <br/>package Graphics::VTK { <br/> use Moose; <br/> <br/> use Inline::Python qw(py_call_function); <br/> use Inline Python =&gt; &quot;import vtk&quot;; <br/> <br/> sub main { <br/> my $self = shift; <br/> my $o = \py_call_function(&quot;vtk&quot;,&quot;vtkPoints&quot;, @_); <br/> my $p = [0,0,0]; <br/> bless $o, &#39;vtk::vtkPoints&#39;; <br/> { <br/> no strict &#39;refs&#39;; <br/> push @{ &quot;vtk::vtkPoints::ISA&quot; }, &#39;Inline::Python::Object&#39;; <br/> } <br/> <br/> $o-&gt;InsertNextPoint($p); <br/> } <br/> <br/> __PACKAGE__-&gt;meta-&gt;make_immutable; <br/>} <br/> <br/>Graphics::VTK-&gt;new-&gt;main unless caller; <br/> <br/>1; <br/> <br/> = http://www.nntp.perl.org/group/perl.inline/2016/05/msg4743.html Fri, 20 May 2016 17:17:07 +0000 Re: Announcing C::Blocks, a different way to interface Perl and C code by David Mertens A follow-up to this email:<br/><br/>On Fri, May 23, 2014 at 8:35 AM, David Mertens &lt;dcmertens.perl@gmail.com&gt;<br/>wrote:<br/><br/>&gt; Hey everyone,<br/>&gt;<br/>&gt; C::Blocks is a new TinyCC-based module, presently only available on<br/>&gt; github. (1) It jit-compiles blocks of C code, building and inserting OPs<br/>&gt; into the Perl OP tree, making invocation of C code essentially free. (2) It<br/>&gt; will allow different blocks of C code to share function and struct<br/>&gt; declarations, thus removing the need to always recompile perl.h, an<br/>&gt; otherwise major cost of jit-compiling C code that can interface with Perl<br/>&gt; and Perl data structures.<br/>&gt;<br/>&gt; I am currently seeking help and encouragement to squash the segfaults that<br/>&gt; currently prevent the completion of the second feature. :-)<br/>&gt;<br/><br/>It took a lot longer than I had expected, but I finally completed the<br/>second feature listed above and released the first &quot;alpha&quot; release of<br/>C::Blocks &lt;https://metacpan.org/pod/C::Blocks&gt; today.<br/><br/>It took a long time because ultimately I had to create my own fork of the<br/>Tiny C Compiler &lt;https://github.com/run4flat/tinycc&gt; that supports extended<br/>symbol tables. I released an Alien distribution<br/>&lt;https://metacpan.org/pod/Alien::TinyCCx&gt; with (what I believe to be a<br/>nearly complete implementation of) extended symbol table support late last<br/>week, and it seems to be passing its test suite decently well<br/>&lt;http://matrix.cpantesters.org/?dist=Alien-TinyCCx+0.06&gt; on a fair number<br/>of platforms. Alien::TinyCCx is doing particularly well on Linux and decent<br/>on Windows. I&#39;m a bit annoyed it&#39;s not passing on Macs because it works on<br/>my Mac. That&#39;ll get fixed soonish, I hope.<br/><br/>It&#39;s still rough around the edges, but it&#39;s surprisingly fast. I have a<br/>number of examples<br/>&lt;https://metacpan.org/source/DCMERTENS/C-Blocks-0.01/examples&gt; that might<br/>give you an idea of how it works. I am particularly fond of my &quot;port&quot;<br/>&lt;https://metacpan.org/source/DCMERTENS/C-Blocks-0.01/examples/libobjmg.pl&gt;<br/>of XS::Object::Magic &lt;https://metacpan.org/pod/XS::Object::Magic&gt;, which<br/>simply involved copying the top half of rafl&#39;s code from his Magic.xs<br/>&lt;https://metacpan.org/source/FLORA/XS-Object-Magic-0.04/Magic.xs&gt; file into<br/>a cshare block.<br/><br/>I plan to write more about it on blogs.perl.org, so I would encourage folks<br/>to check there if interested.<br/><br/>David http://www.nntp.perl.org/group/perl.inline/2015/08/msg4742.html Tue, 04 Aug 2015 00:53:41 +0000 Finding Inline::Java on cpanmetadb failed by Russ Tremain Hi Patrick,<br/><br/>When I use cpanm to install Inline::Java, I get an warning:<br/><br/>==&gt; Found dependencies: Inline::Java<br/>! Finding Inline::Java on cpanmetadb failed.<br/>--&gt; Working on Inline::Java<br/>Fetching http://www.cpan.org/authors/id/E/ET/ETJ/Inline-Java-0.58.tar.gz ... OK<br/><br/>And indeed I cannot find the top-level module when I search manually:<br/><br/> http://cpanmetadb.org/v1.0/search?search=Inline::Java<br/><br/>It lists all the sub-packages, however.<br/><br/>So is this a meta-data specification issue, or an issue with cpanmetadb?<br/><br/>thanks,<br/>-Russ<br/> http://www.nntp.perl.org/group/perl.inline/2015/07/msg4741.html Fri, 31 Jul 2015 21:03:45 +0000 printing to stderr by rahed Hi,<br/><br/>I use module Inline::Java like this:<br/><br/>use Inline Java =&gt; &#39;DATA&#39;;<br/><br/>I&#39;d like to print from a java code to stderr. My framework is a daemon,<br/>only WARN signals are catched and sent through syslog to a console. Is<br/>it possible to print from a DATA section of a java code? I tried<br/>System.err.println with no effect.<br/><br/>Thanks.<br/><br/>-- <br/>Radek<br/> http://www.nntp.perl.org/group/perl.inline/2015/02/msg4740.html Fri, 06 Feb 2015 11:21:27 +0000 RE: Inline::Python but vice versa by Konovalov, Vadim From: Stefan Seifert [mailto:nine@detonation.org] <br/>&gt; On Saturday 13 December 2014 12:44:22 Konovalov, Vadim wrote: <br/>&gt; <br/>&gt; &gt; A hopefully simple question, <br/>&gt; &gt; Is it possible to use Perl from Python? <br/>&gt; &gt; <br/>&gt; &gt; All I want to do - to script some editor with perl, whereas only <br/>&gt; &gt; python scripting is available... <br/>&gt; <br/>&gt; You mean your editor is written in Perl and you want to <br/>&gt; allow for your users to script it in Python and these <br/>&gt; Python scripts should be able to call back into Perl to for <br/>&gt; example call API methods? <br/> <br/>No, <br/>There is existing editor (e.g. sublime or maybe KIG - KDE 2D-geometry) <br/>which is scripted by python already, <br/>but I want to use Perl from there. <br/> <br/>What I actually want - is a module inside vanilla python that allows me to run Perl, ... <br/> <br/>I&#39;ve read &quot;Using-Perl-inside-Python-inside-Perl&quot; but seems to me this isn&#39;t exactly what helps me in this situation. <br/>Yet I already used Perl-inside-Python-inside-Perl :) <br/>The cool stuff possible with Inline::Python is that I can write fully functional application with Qt, whereas Qt used via Python (perlQt are all stale) and I was able to do this way - <br/> <br/>use Inline Python =&gt; &lt;&lt;&#39;EOS&#39;; <br/>....... <br/> self.pushButton = QtGui.QPushButton(&quot;&amp;Foo Button&quot;) <br/>..... <br/> self.pushButton.clicked.connect(perl.qwerty); <br/>...... <br/>EOS <br/> <br/>my $app = get_app(); <br/>my $w = init_some_window(); <br/> <br/>sub qwerty { <br/> $w-&gt;{pushButton}-&gt;setText(&#39;[&#39;.$w-&gt;{pushButton}-&gt;text().&#39;]&#39;); <br/>} <br/> <br/>$app-&gt;exec_(); <br/> <br/>Really really really cool stuff :) <br/> <br/>Have a nice day, <br/>Vadim. <br/> http://www.nntp.perl.org/group/perl.inline/2014/12/msg4739.html Sat, 13 Dec 2014 13:40:06 +0000 Re: Inline::Python but vice versa by Stefan Seifert Hi Vadim,<br/><br/>On Saturday 13 December 2014 12:44:22 Konovalov, Vadim wrote:<br/><br/>&gt; A hopefully simple question,<br/>&gt; Is it possible to use Perl from Python?<br/>&gt; <br/>&gt; All I want to do - to script some editor with perl, whereas only python<br/>&gt; scripting is available... Of course my editor-api calls will be issued with<br/>&gt; Inline::Python or something like that.<br/><br/>You mean your editor is written in Perl and you want to allow for your users <br/>to script it in Python and these Python scripts should be able to call back <br/>into Perl to for example call API methods?<br/><br/>Yes, that&#39;s exactly what my use case looks like and probably what&#39;s tested <br/>best. You could for example pass an Editor object as parameter to your Python <br/>script and the script may use it like it was a plain normal Python object and <br/>call methods on it.<br/><br/>https://metacpan.org/pod/distribution/Inline-Python/Python.pod#Using-Perl-inside-Python-inside-Perl may give you additional pointers to what&#39;s possible.<br/><br/>Please feel free to ask any questions that may come up on how to integrate <br/>Python scripting. I do have quite some experience on how to bridge these two <br/>languages and am happy to help.<br/><br/>Regards,<br/>Stefan<br/> http://www.nntp.perl.org/group/perl.inline/2014/12/msg4738.html Sat, 13 Dec 2014 13:09:43 +0000 Inline::Python but vice versa by Konovalov, Vadim Dear Stefan, <br/>First of all, thank you for maintaining such a useful module, <br/> <br/>All other supporters, thank you to make the really nice module possible :) <br/> <br/>A hopefully simple question, <br/>Is it possible to use Perl from Python? <br/> <br/>All I want to do - to script some editor with perl, whereas only python scripting is available... <br/>Of course my editor-api calls will be issued with Inline::Python or something like that. <br/> <br/>Interested in solutions that are not only theoretical but verified in practice :) <br/> <br/>Thanks in advance, <br/>Vadim. <br/> http://www.nntp.perl.org/group/perl.inline/2014/12/msg4737.html Sat, 13 Dec 2014 12:44:41 +0000 Re: Inline-Java Installation using Cygwin and JDK1.8 ERROR /usr/bin/dlltool: Can't open def file: jvm.def by Ed . Hi Peter, <br/> <br/>Thanks for the report! For whatever reason, the jvm.def and test files weren&acirc;&#128;&#153;t in the repo, but they are now (and in newly-released 0.55). Please give it a go and see whether it works. <br/> <br/>Cheers, <br/>Ed <br/> <br/>From: Peter Leong <br/>Sent: Friday, November 14, 2014 8:59 AM <br/>To: inline@perl.org <br/>Subject: Inline-Java Installation using Cygwin and JDK1.8 ERROR /usr/bin/dlltool: Can&#39;t open def file: jvm.def <br/> <br/>Hi, <br/> <br/>I have been trying to install Inline::Java with JNI on Cygwin Windows 7 on jdk1.8.0_25 without much avail. Have anyone been successful with installing in Cygwin on jdk1.8.0.25? <br/> <br/>/usr/bin/dlltool: Can&#39;t open def file: jvm.def <br/> <br/>Checking if your kit is complete... <br/>Warning: the following files are missing in your kit: <br/> Java/jvm.def <br/> Java/PerlNatives/t/01_init.t <br/> Java/PerlNatives/t/02_perl_natives.t <br/>Please inform the author. <br/>WARNING: ABSTRACT contains control character(s), they will be removed <br/> <br/> <br/>Thanks <br/>Peter http://www.nntp.perl.org/group/perl.inline/2014/11/msg4736.html Fri, 14 Nov 2014 15:04:15 +0000 Inline-Java Installation using Cygwin and JDK1.8 ERROR/usr/bin/dlltool: Can't open def file: jvm.def by Peter Leong Hi,<br/><br/>I have been trying to install Inline::Java with JNI on Cygwin Windows 7 on<br/>jdk1.8.0_25 without much avail. Have anyone been successful with<br/>installing in Cygwin on jdk1.8.0.25?<br/><br/>/usr/bin/dlltool: Can&#39;t open def file: jvm.def<br/><br/>Checking if your kit is complete...<br/>Warning: the following files are missing in your kit:<br/> Java/jvm.def<br/> Java/PerlNatives/t/01_init.t<br/> Java/PerlNatives/t/02_perl_natives.t<br/>Please inform the author.<br/>WARNING: ABSTRACT contains control character(s), they will be removed<br/><br/><br/>Thanks<br/>Peter http://www.nntp.perl.org/group/perl.inline/2014/11/msg4735.html Fri, 14 Nov 2014 13:44:01 +0000 WriteInlineMakefile deprecated by Ed . Hi,<br/><br/>The following CPAN distribs use WriteInlineMakefile. This is deprecated, <br/>please change to WriteMakefile.<br/><br/>Mail::ClamAV - bundles Inline::MakeMaker, please don&#39;t do that.<br/><br/>Refer in Makefile.PL:<br/>Ogg::Vorbis::Header<br/>Freq<br/>Tie::GHash<br/>Video::OpenQuicktime<br/>Audio::Ao<br/>UNIX::Cal<br/>Bloom16<br/><br/>Module::Depends - fakes use of WriteInlineMakefile as part of functioning<br/><br/>PDL - please update in example Example/InlinePdlpp/Module/Makefile.PL<br/><br/>Best regards,<br/>Ed J<br/>Inline team <br/><br/> http://www.nntp.perl.org/group/perl.inline/2014/08/msg4734.html Fri, 15 Aug 2014 20:40:09 +0000 JNI segfault on exit by GP2U Telehealth Using Inline::Java and the JVM everything is fine. If JNI is invoked<br/>then it works, but on exit segfaults tyring to invalidate a non<br/>existant pointer.<br/>Anyone got a pointer to how to avoid/fix this?<br/><br/>[root@w32 JNI]# cat Hello.java JNICrash.pm jni.pl<br/>public class Hello {<br/> String Message;<br/> public Hello(<br/> String Message<br/> ) {<br/> this.Message = Message;<br/> }<br/> public int speak() {<br/> System.out.println( this.Message );<br/> return 0;<br/> }<br/>}<br/><br/>package JNICrash;<br/><br/>use strict;<br/>use warnings;<br/>BEGIN {<br/> $ENV{CLASSPATH} = &#39;.&#39;;<br/> $ENV{PERL_INLINE_JAVA_JNI} = 1;<br/><br/>sub CrashNBurn {<br/> my ($msg) = @_;<br/> use Inline (<br/> Java =&gt; &#39;STUDY&#39;,<br/> STUDY =&gt; [ &#39;Hello&#39; ],<br/> DEBUG =&gt; 1, #5,<br/> DIRECTORY =&gt; &#39;/tmp/&#39;,<br/> PACKAGE =&gt; &#39;main&#39;,<br/> );<br/> my $java = new Hello( $msg );<br/> $java-&gt;speak();<br/> #undef $java;<br/>}<br/>1;<br/><br/>#!/bin/env perl<br/><br/>use strict;<br/>use lib &#39;.&#39;;<br/>use JNICrash;<br/>JNICrash::CrashNBurn( &quot;Hello, world!&quot; );<br/>[download] &lt;http://perlmonks.org/?abspart=1;displaytype=displaycode;node_id=1094297;part=1&gt;<br/><br/>Which runs fine when $ENV{PERL_INLINE_JAVA_JNI} = 0 but produces this when<br/>PERL_INLINE_JAVA_JNI = 1<br/><br/>[root@w32 JNI]# ./jni.pl<br/>[perl][1] validate done.<br/>[perl][1] Starting load.<br/>[perl][1] starting JVM...<br/>[perl][1] JNI mode<br/>[perl][1] using jdat cache<br/>[perl][1] load done.<br/>[java][1] loading InlineJavaUserClassLink via InlineJavaUserClassLoader<br/>Hello, world!<br/>[perl][1] killed by natural death.<br/>[perl][1] JVM owner exiting...<br/>[perl][1] exiting with 0<br/>*** glibc detected *** perl: munmap_chunk(): invalid pointer: 0x00c0446c ***<br/>======= Backtrace: =========<br/>/lib/libc.so.6[0xa10e31]<br/>perl(Perl_safesysfree+0x21)[0x80cde41]<br/>perl(perl_destruct+0x200)[0x807a690]<br/>perl(main+0xf3)[0x805fff3]<br/>/lib/libc.so.6(__libc_start_main+0xe6)[0x9b6d26]<br/>perl[0x805fe61]<br/>======= Memory map: ========<br/>[snip]<br/>[download] &lt;http://perlmonks.org/?abspart=1;displaytype=displaycode;node_id=1094297;part=2&gt;<br/><br/>This happens on CentOS 5 &amp; 6 with versions of Perl 5.10, 5,12, 5,18. Inline<br/>is 0.53<br/><br/>Dr James Freeman http://www.nntp.perl.org/group/perl.inline/2014/07/msg4733.html Mon, 28 Jul 2014 15:52:50 +0000 [rt.cpan.org #97443] I have found a bug! by Ed J via RT Wed Jul 23 15:55:10 2014: Request 97443 was acted upon.<br/>Transaction: Correspondence added by ETJ<br/> Queue: Inline<br/> Subject: I have found a bug!<br/> Broken in: (no value)<br/> Severity: (no value)<br/> Owner: Nobody<br/> Requestors: ej_zg@hotmail.com<br/> Status: new<br/> Ticket &lt;URL: https://rt.cpan.org/Ticket/Display.html?id=97443 &gt;<br/><br/><br/>Test successful - bugs still get registered/notified via RT even though other &quot;preferred bug-tracker&quot;.<br/> http://www.nntp.perl.org/group/perl.inline/2014/07/msg4732.html Wed, 23 Jul 2014 19:55:17 +0000 [rt.cpan.org #97443] I have found a bug! by Ed . via RT Wed Jul 23 15:41:36 2014: Request 97443 was acted upon.<br/>Transaction: Ticket created by ej_zg@hotmail.com<br/> Queue: Inline<br/> Subject: I have found a bug!<br/> Broken in: (no value)<br/> Severity: (no value)<br/> Owner: Nobody<br/> Requestors: ej_zg@hotmail.com<br/> Status: new<br/> Ticket &lt;URL: https://rt.cpan.org/Ticket/Display.html?id=97443 &gt;<br/><br/><br/><br/><br/> http://www.nntp.perl.org/group/perl.inline/2014/07/msg4731.html Wed, 23 Jul 2014 19:41:43 +0000 Re: undefined symbol: PL_stack_sp by sisyphus1 <br/>From: Ingy dot Net<br/>Sent: Saturday, July 19, 2014 2:28 AM<br/>Subject: Re: undefined symbol: PL_stack_sp<br/><br/>&gt; Can someone turn this into an issue here <br/>&gt; https://github.com/ingydotnet/inline-c-pm/issues<br/><br/>Done.<br/>Please direct follow-ups to:<br/><br/>https://github.com/ingydotnet/inline-c-pm/issues/12<br/><br/>Cheers,<br/>Rob <br/><br/> http://www.nntp.perl.org/group/perl.inline/2014/07/msg4730.html Sun, 20 Jul 2014 02:40:22 +0000 [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules by Ed J via RT Sat Jul 19 18:50:38 2014: Request 95809 was acted upon.<br/>Transaction: Correspondence added by ETJ<br/> Queue: Inline<br/> Subject: [PATCH] Using Inline in a distribution with multiple modules<br/> Broken in: (no value)<br/> Severity: (no value)<br/> Owner: Nobody<br/> Requestors: slam@parasite.cc<br/> Status: open<br/> Ticket &lt;URL: https://rt.cpan.org/Ticket/Display.html?id=95809 &gt;<br/><br/><br/>Test contributed by neomorphic, in Inline::C/test/27inline_maker.t. Closing.<br/> http://www.nntp.perl.org/group/perl.inline/2014/07/msg4729.html Sat, 19 Jul 2014 22:50:47 +0000 [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules by Ed J via RT &lt;URL: https://rt.cpan.org/Ticket/Display.html?id=95809 &gt;<br/><br/>Test contributed by neomorphic, in Inline::C/test/27inline_maker.t. Closing.<br/> http://www.nntp.perl.org/group/perl.inline/2014/07/msg4728.html Sat, 19 Jul 2014 22:50:45 +0000