Question about creating modules

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default Question about creating modules

    Hi,

    I'm new to perl and need a little help. I'm using ActiveState Perl under
    windows. I've tried creating a module from a C++ source using swig and the
    methods outlined in both the perl documentation and the swig documentation.
    I have VC++ installed and making the dll files works successfully. However
    when I try to load the module the perl interpreter seems to loop forever.
    The problem seems to occur at the bootstrap stage. Unfortunately I don't
    know enough to make a good guess as too what's going on.

    I'll try to give a little background as to what I'm trying to achieve. I
    have a DLL that I want access from perl. The glue that I need between perl
    and the DLL is really just a class definition with a list of pure functions
    (some using VARIANT's) that correspond to a virtual table as setup by the
    DLL I want to call. The module I'm trying to create only contains 2
    functions one to create an instance of the class object and one to destroy
    it. SWIG seemed to be what I needed but having produced the necessary file
    nd done what I can. I seem to be stuck.

    I'm using version 5.8.8 of perl and I have stripped out everything in my C++
    code, recompiled and made the library and still it wont load.

    Can anybody help?

    Leon


    Mr Cheeky Monkey Guest

  2. Similar Questions and Discussions

    1. Creating Makefiles for multiple nested modules
      I just wanted to preface this with this is my first experience making Perl modules, so if this is completely trivial, please laugh at me, call me a...
    2. Question about building modules on W2K
      Hello, I have two environments here -- development and production. The software architecture of the boxes are strictly controlled by the...
    3. Class Modules Question
      Gday :) I have a DLL project which calls data via ADO and exposes the various fields as Property(s). I'm getting a comile error: ...
    4. Creating Perl Modules
      Does anyone know of any step by step (or as easy) tutorials for creating a perl module? Type of modules that don't use EXPORTER. I can't...
    5. Modules Question
      I use Text::Bastardize off of the CPAN from time to time. I find it mildly amusing, if not terribly practical. However, today when I was working...
  3. #2

    Default Re: Question about creating modules


    "Mr Cheeky Monkey" <cheeky.monkey23@hotmail.co.uk> wrote in message
    news:u8udnV4oIYYcJuXZnZ2dnUVZ8qGdnZ2d@bt.com...
    > Hi,
    >
    > I'm new to perl and need a little help. I'm using ActiveState Perl under
    > windows. I've tried creating a module from a C++ source using swig and the
    > methods outlined in both the perl documentation and the swig
    documentation.
    > I have VC++ installed and making the dll files works successfully.
    Which version of VC++ ? With ActiveState perl you really should be using 6.0
    (as that's what was used to build perl), though you'll *generally* get good
    milage from other (later) VC++ versions. I don't know if/how such a mismatch
    would impact upon swig.
    > However
    > when I try to load the module the perl interpreter seems to loop forever.
    > The problem seems to occur at the bootstrap stage. Unfortunately I don't
    > know enough to make a good guess as too what's going on.
    >
    In fact, I know stuff-all about swig - so, if you're committed to using
    swig, I can't be of much use :-)

    However, if you're simply trying to access a dll, there are a number of
    other options.
    You could use Inline::C (or perhaps in this case Inline::CPP would be more
    appropriate).
    Or you could write your own extension (module) with XS - which is pretty
    much what Inline::C/Inline::CPP do, though they do it using an automated
    process. There's a good example of accessing a dll in the Inline::C cookbook
    (see the section "Just Desserts" in perldoc Inline::C-Cookbook).
    Another alternative is to use Win32::API - for which no compiler is needed,
    and which is a fairly popular hack (though I personally prefer to avoid it).
    >
    > I'm using version 5.8.8 of perl and I have stripped out everything in my
    C++
    > code, recompiled and made the library and still it wont load.
    >
    Make sure you're using build 817 (or later):
    perl -e "print $ActivePerl::VERSION"

    Build 816 (which is a 5.8.8 build) is a bad build and should be avoided
    altogether.

    Cheers,
    Rob


    Sisyphus Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139