...and whether this is worth pursuing further

hmm, I'll take that as a resounding "No!". Fair enough.

For completeness, heres what worked/sucked:

Ive included the basic source that compiled on both platforms, as I will be removing the link in the OP. Maybe at least, this will be of some use to windows users that dont have MSVC... you may also be interested in these:

275516 - BrowserUks results compiling perl with bcc32
sieperl - binary perl builds with GPL/Artistic licensing.

#ifndef perlembed_h #define perlembed_h /* ** compilation examples for bcc32 and gcc linux ** bcc32 -DEMBED_WIN32 ** gcc -ldl -lpthread -DEMBED_LINUX ** ** int main(int argc, char** argv, char** env) ** { ** perlembed_setup("/path/to/libperl.so/or/perl58.dll"); ** perlembed_main(argc, argv, env); ** perlembed_teardown(); ** return 0; ** } **/ #ifdef EMBED_WIN32 #define WIN32_LEAN_AND_MEAN #include <windows.h> #endif #ifdef EMBED_LINUX #include <dlfcn.h> #endif int perlembed_setup(char* DllPath); void perlembed_main(int argc, char** argv, char** env); void perlembed_teardown(); void* perlembed_loadLibrary(char* DllPath); void* perlembed_getProcAddress(char* symbol); void perlembed_freeLibrary(void* perlDll); static struct { void* interpreter ; void* dll ; int loadedOK ; void* (*alloc) (); void (*construct) (void*); void (*parse) (void*, void*, int, char**, char**); void (*destruct) (void*); void (*free) (void*); void (*run) (void*); } perlembed; /* ** dynamically links to the appropriate perl library */ int perlembed_setup( char* DllPath ) { if(perlembed.loadedOK ) return 1; perlembed.dll = perlembed_loadLibrary(DllPath); if(perlembed.dll) { perlembed.alloc = perlembed_getProcAddress("perl_alloc"); perlembed.construct = perlembed_getProcAddress("perl_construct"); perlembed.parse = perlembed_getProcAddress("perl_parse"); perlembed.destruct = perlembed_getProcAddress("perl_destruct"); perlembed.free = perlembed_getProcAddress("perl_free"); perlembed.run = perlembed_getProcAddress("perl_run"); perlembed.interpreter= perlembed.alloc(); perlembed.construct( perlembed.interpreter ); perlembed.loadedOK = 1; return 0; } return 1; } /* ** frees the interpreter */ void perlembed_teardown() { if( !perlembed.loadedOK ) return; perlembed.free(perlembed.interpreter); perlembed.destruct(perlembed.interpreter); perlembed.loadedOK = 0; perlembed_freeLibrary( perlembed.dll ); } /* ** runs as perl with the given commandline */ void perlembed_main(int argc, char** argv, char** env) { if( !perlembed.loadedOK ) return; perlembed.parse(perlembed.interpreter, 0, argc, argv, env); perlembed.run(perlembed.interpreter); } void* perlembed_getProcAddress(char* symbol) { #ifdef EMBED_WIN32 return GetProcAddress( perlembed.dll, symbol ); #endif #ifdef EMBED_LINUX return dlsym(perlembed.dll, symbol); #endif } void* perlembed_loadLibrary(char* DllPath) { #ifdef EMBED_WIN32 return LoadLibrary(DllPath); #endif #ifdef EMBED_LINUX return dlopen(DllPath, RTLD_LAZY|RTLD_GLOBAL); #endif } void perlembed_freeLibrary(void* perlDll) { #ifdef EMBED_WIN32 FreeLibrary( perlDll ); #endif #ifdef EMBED_LINUX dlclose(perlDll); #endif } #endif



time was, I could move my arms like a bird and...

In reply to Re: poor mans embedding by Ctrl-z
in thread poor mans embedding by Ctrl-z

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.