Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi.

I'm going to write a couple of XS modules (they will be in the Win32 namespace, but i think that is a general question!). Some of them dependent on others. Example:

package Foo::Bar;
package Foo::Bar::Builder;
package Foo::Bar::Store;
* Foo::Bar::Builder creates an Foo::Bar object.
* Foo::Bar objectes can be stored in a Foo::Bar::Store.

Right now i have the following structure:

Foo/Bar.xs
Foo/Bar/Builder.xs
Foo/Bar/Store.xs
How does Foo::Bar::Builder and Foo::Bar::Store know, that there is a Foo::Bar or better what Foo::Bar is! (Builder has a create function that returns a Foo::Bar object (TYPEMAP Foo::Bar T_PTROBJ)).

or is it better to put everything into Foo/Bar.xs like
MODULE = Foo::Bar        PACKAGE = Foo::Bar
MODULE = Foo::Bar        PACKAGE = Foo::BarPtr
MODULE = Foo::Bar::Store        PACKAGE = Foo::Bar::Store
MODULE = Foo::Bar::Store        PACKAGE = Foo::Bar::StorePtr
MODULE = Foo::Bar::Builder        PACKAGE = Foo::Bar::Builder
MODULE = Foo::Bar::Builder        PACKAGE = Foo::Bar::BuilderPtr
or (like that?)

MODULE = Foo::Bar        PACKAGE = Foo::Bar
MODULE = Foo::Bar        PACKAGE = Foo::BarPtr
MODULE = Foo::Bar        PACKAGE = Foo::Bar::Store
MODULE = Foo::Bar        PACKAGE = Foo::Bar::StorePtr
MODULE = Foo::Bar        PACKAGE = Foo::Bar::Builder
MODULE = Foo::Bar        PACKAGE = Foo::Bar::BuilderPtr

<edit1>Typo fixed.</edit1>
<edit2>So in general, how do i call the new function of Foo::Bar (defined in Foo/Bar.xs) inside Foo/Bar/Builder.xs?</edit2>

In reply to XS Modules: Dependencies by esskar

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-24 02:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found