This section describes what to do if you want to write some all new SOM WPS class, which should be integrated into the main XWorkplace DLL, and describe which files need to be changed to have your stuff compiled into the whole thing.
  1. Most importantly, I suggest that you put all your code into a separate source directory in the XWorkplace 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.

  2. Create a new IDL file for your class. As a template, you can use 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.

  3. Run the main makefile once. The makefile in 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\.

  4. Now that you have the stub C file in 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.

  5. In 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.

  6. Coding. For your C code, make sure that you get the #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.

  7. Note that the SOM compiler is unable to recognize that several classes should be put into the same DLL and create a common .DEF file for this purpose, so you have to do this manually.

    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.

  8. Finally, take a look at \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).

This should work. If you have any questions, feel free to contact me.