SRC\
and INCLUDE\
directory trees.
Please do not put your stuff into SRC\FILESYS
,
because this will make it pretty difficult to maintain order.
For the purpose of explanations here, I will assume that your directory is
called SRC\YOURDIR\
and your class is called XWPYourClass
.
So first of all, create your two subdirectories (YOURDIR
) in
INCLUDE
and SRC
.
idl\__sample_dataf.idl
, which is a sample for a WPDataFile subclass.
Put your new IDL file into the idl\
directory and modify the
makefile in there to recognize your IDL file. That is, add your header file to
the all:
statement and add a corresponding line to the bottom.
That's all. And please, add a comment that you did so.
For the purpose of clarity, I suggest that with your IDL file, you take one of the existing IDL files as a template. My IDL coding style has evolved during the last two years, and I now consider the comments etc. in there pretty lucid in order not to forget anything. Of course, if you have something better, go ahead.
idl\
will realize
that a new .IDL
file has been added and create headers in
include\classes\
, a .DEF
file in idl\, and stub C code
in src\classes\
.
src\classes,
modify the
makefile in src\classes
to compile your stub file as well. Add your
file to the OBJS macro, and add dependency rules in the
$(OUTPUTDIR)\xxx.obj:
style to the bottom.
Again, add a comment that you did so.
SRC\YOURDIR\
, write your own makefile which compiles your
sources. You can take the makefile in SRC\FILESYS\
as a template. This
makefile is pretty smart because it automatically recognizes whether it is called
from the main makefile, and if not, it invokes the main makefile, which in turn
will call the sub-makefiles later. Also, that makefile uses the general makefile
include setup.in
in the main directory for compiler setup etc.
Make sure that your makefile writes all .OBJ
files into the
BIN
directory, which your makefile must create if it doesn't exist yet.
Again, see how the makefile in SRC\FILESYS
does this.
Other than that, in SRC\YOURDIR
, do whatever you want.
#include
's
right.
Take a look at any C file in SRC\FILESYS
for examples (folder.c
is a good candidate, because it's fairly complex). If you use any headers from
include\shared\
, there are certain rules that you must follow, because
these headers require other headers to be included already.
Also, I strongly recommend to always include include\setup.h
,
because this will automatically make your code PMPRINTF-enabled.
I don't care about your coding style, but if you want your code to be
documented automatically, you should follow mine, because otherwise
xdoc.exe
won't work.
See Code documentation for details.
So have the SOM compiler create a .DEF file for your class from your .IDL
source file. (The makefile in idl\
will do this automatically if you
have added your header to the all:
target.)
Then take the block below the EXPORTS
line from the .DEF file
and add it to the bottom of src\shared\xwp.def
(which is the module
definition file used for linking the whole XWorkplace DLL). These structures make
the SOM kernel see your class in the DLL. If you don't do this, your class
cannot be registered.
\makefile
. This is the "master makefile"
which links all .OBJ modules into the main XWorkplace DLL (XFLDR.DLL
).
In that makefile, there is an OBJS
macro which lists all the .OBJ files
which are to be linked together.
Add your .OBJ file(s) to the end of that variable (and please, add a comment that you did so).