[C++-sig] Limit On No. Of Constructors?
Scott A. Smith
ssmith at magnet.fsu.edu
Thu Nov 14 16:48:09 CET 2002
> You need to either get a better compiler (even vc7 would be an
> improvement), or split your module code across translation units
> (source files). To do that, declare a function in another source file
> taking a class_<SinglePar>& parameter, and move some of your .def()
> calls there.
In another message you wrote:
> Split up your file into multiple translation units (separate source
> files). Your module initialization function can call a function
> defined in another source file to expose additional functionality.
Ouch. It'll be a while before I can upgrade to .NET, but I am trying to
build my modules multiplatform so I run with GCC using CygWin & Linux (& one
perhaps even OSX). But for now, I am hoping you can clarify your statements
on how to deal with the vc6 problem.
1.) When I declare a class:
... class constructors and functions
it would seem that all .def() calls for the class must reside before
the semi-colon used for the class end. Hence, I don't see how I can move
of these into a separate file. I have no problems moving entire classes
into individual files. I don't understand how I can use a
parameter in a different file then continue putting in .def() calls that
are part of the class MyClass. Could you give me a brief example?
2.) Is it possible to blend modules. That is, make a Python module that has
class A, one that has class B, then somehow blend the two into a single
module. Then only the summed moduled is imported into Python rather than
all of the individual ones?
3.) I keep all my BP functions in separate files, except those functions
needed to be part of a class (e.g. for weak wrapping using V1). I have
always done this using header files, so the structure of my code is
different from all of the tutorial examples. I am wondering if, for
reasons, I should be keeping my BP functions in (.cpp) files instead?
Currenty I have a single header file that contains, among other things,
# include <FileA.h>
# include <FileB.h>
Is there a better, or more standardized, way of organizing my code while
keeping what is related to BP largely away from what is my project's
usual C++ code?
More information about the Cplusplus-sig