Patrick Dupre wrote:
>> Patrick Dupre wrote:
>>> On Fri, 22 Aug 2008, Rob Dixon wrote:
>>>> Patrick Dupre wrote:
>>>>>
>>>>> How can I modify my Makefile.PL to have a Makefile which can make
>>>>> cc -o test.o -c test.c `perl -MExtUtils::Embed -e ccopts`
>>>>>
>>>>> Thank
>>>>
>>>> Makefile.PL is a program written using ExtUtils::MakeMaker to generate a
>>>> makefile for building a Perl /extension/ module.
>>>>
>>>> ExtUtils::Embed is a module that will generate C code and compile/link 
>>>> options
>>>> for /embedding/ a perl interpreter into a C program.
>>>>
>>>> Extending and embedding Perl are two very different, almost opposite ideas.
>>>>
>>>> Since it looks like you have a program called test.c I assume you want to 
>>>> embed
>>>> a perl interpreter into that program, and if so you can forget about
>>>> Makefile.PL. But in that case what are you asking? You clearly know how to
>>>> compile test.c as you have written it in your post, and it is 
>>>> straightforward to
>>>> write a makefile to do that if you want to.
>>>>
>>>> So what help do you need from us?
>>>>
>>> In fact, I have a Makefile.Pl because I am using ExtUtils to generate
>>> c for perl (with xs), but I also need to call a perl subroutine for c !!
>>> I know, it may be not elegant, but it is where I am !!
>>>
>>> So I need the Makefile.PL correct to generate the lib for perl
>>> and to compile the c to have it be able to call perl.
>>
>> So you are embedding a perl interpreter into an XS extension because you 
>> need to
>> call a Perl subroutine from that extension. Is that right? If so then you 
>> should
>> just be able to manipulate the Perl stack and make the call using call_sv or
>> similar. Take a look at
>>
>>  perldoc perlcall
>>
>> for help on this. Or let me know if I'm not understanding you correctly.
> 
> So, you do not have any solution for me ?

Yes I do. Let me explain myself a little more.

If you are using the standard perl interpreter to run a program that loads an
extension module you have written using XS then there is no point in linking yet
another copy of the interpreter into the process. All you need to do is to code
the subroutine call in your XS code and it should work. As I said, if you read

  perldoc perlcall

then you should find an example of what you want to do.

Obviously I can't be more specific without knowing more about your requirement.
Are you trying to execute a callback subroutine that was passed in the original
call to your extension? Or is it just that you want to do something that is
neater and more concise written in Perl?

HTH,

Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to