Advertisement

04.20.2008 at 03:42AM PDT, ID: 23337574
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Link to Win32 API

Asked by Shony in Perl Programming Language, C Programming Language

Tags: ,

I want to execute a perl script from C, using perlembed (ActiveState).
The error is when loading Win32::API.
When adding this reference to the calling C program, it won't link:

//-----------------------------------------------------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif

#include <EXTERN.h>               /* from the Perl distribution     */
#include <perl.h>                 /* from the Perl distribution     */

#ifdef __cplusplus
}
#endif

static PerlInterpreter *my_perl;  /***    The Perl interpreter    ***/

static void xs_init (pTHX);

EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
EXTERN_C void boot_Win32 (pTHX_ CV* cv);
EXTERN_C void boot_Win32API (pTHX_ CV* cv);

void
xs_init(pTHX)
{
        char *file = __FILE__;
        dXSUB_SYS;

        // DynaLoader is a special case
        newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
        newXS("WIN32::bootstrap", boot_Win32, file);
        newXS("WIN32::API::bootstrap", boot_Win32API, file);
}

int main(int argc, char **argv, char **env)
{
        PERL_SYS_INIT3(&argc,&argv,&env);
        my_perl = perl_alloc();
        perl_construct(my_perl);
        PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
        perl_parse(my_perl, xs_init, argc, argv, (char **)NULL);
        perl_run(my_perl);
        perl_destruct(my_perl);
        perl_free(my_perl);
        PERL_SYS_TERM();
}

C:\Temp/cccRbaaa.o(.text+0x5a):interp-all.cpp: undefined reference to `boot_Win32API'
collect2: ld returned 1 exit status

I included the library-paths
c:/perl/lib/auto/Win32/Win32.lib,
c:/perl/site/lib/auto/Win32/API/API.lib

Only Win32.lib was linked.
Start Free Trial
[+][-]04.21.2008 at 01:33AM PDT, ID: 21399563

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 05:55AM PDT, ID: 21401122

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Perl Programming Language, C Programming Language
Tags: Perl, perlembed, Windows XP
Sign Up Now!
Solution Provided By: Shony
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628