1.5 Creating a New Project with CodeWarrior

Install the following items on your development machine in the order listed:

  1. CodeWarrior

  2. LibC SDK

  3. CodeWarrior Professional Developer Kit (PDK) for NetWare

See the CodeWarrior documentation for workstation requirements and installation instructions for CodeWarrior and the PDK. The PDK requires a NovellNDK environment variable. For the variable, enter NovellNDK. For its value, enter the location of the LibC SDK (the default is c:\novell\ndk\libc). CodeWarrior requires that you install the LibC NDK on the C: drive.

The following instructions explain how to create a new stationery project with PDK 4.0 that you can use to compile the sample code.

  1. Start CodeWarrior.

  2. Select File > New.

  3. From the Project tab, select NetWare Stationery.

  4. In the Project name box, specify a name for the project, for example, Sample Code. In the Location box, specify the path where you want to store the project's files, then click OK.

  5. In the New Project window, select Server > NKS-LibC > Generic C, then click OK.

  6. Expand NetWare SDK Libraries. From the list of files, select the mwcrtl.lib and mwcrtld.lib files, press Delete, then click OK.

  7. Replace the libcpre.o file with the updated file included with the SDK.

    Delete libcpre.o. To add the newer one, right-click NetWare SDK Libraries, select Add Files from the drop-down menu, browse to the c:\novell\ndk\libc\imports directory, then select libcpre.o and press Enter.

  8. Expand Source. From the list of files, select the main.c file, press Delete, then click OK.

  9. Right-click Source, then from the drop-down menu, select Add Files.

  10. Browse to the LibC sample code directory (the default location is c:\novell\ndk\samples\libc_sample), and select one of the sample code files to compile, for example, KeyValue.c.

    Each sample file is designed to be compiled as a separate NLM.

  11. Click the Generic C Build Settings icon.

  12. In the Target category, click NLM Target and modify the following fields:

    Field

    Description

    Output File

    Specify a name for the NLM.

    Screen Name and Initial Screen Name

    Specify the default screen for the NLM. If the NLM receives input from a user, select User Specified and enter a name in the Initial Screen Name field. If the NLM receives no input from a user, you can select either Console (allows console output of messages) or No Default (prevents console output and input).

    For this sample code project, select User Specified and enter a name that matches the sample file you selected.

    Stack Size

    Specify the maximum size of a thread stack. For the sample code, the default value of 16384 is adequate. For most applications you should set this value between 32767 and 65535.

    Copyright

    Specify your company's copyright string.

    Description

    Supply a description that fits the NLM. This description appears in various NetWare management utilities

    When you have completed your modifications to the form, click OK.

  13. Click the Make icon.

  14. When the compiler finishes, browse to the location of your project files.

  15. Copy the compiled *.nlm file to the sys:\system directory of your NetWare server.

    Other locations are possible, but if you create your own directory, you also need to add search paths or include the path in the load command.

  16. At the system console, load the NLM.

NOTE:In the Generic C Build Settings > Linker > NLM Linker > Flags option, the PseudoPreemption flag is no longer required for NetWare 6.0 SP3 and NetWare 5.1 SP6. Earlier versions require this flag, or the NLM does not load.

For more information, see the Metrowerks manuals. The Targeting the NetWare Operating System manual explains all the Generic C Build Settings.

If you prefer a command line interface, the Metrowerks manual explains how to access these development tools and their online documentation.

HINT:The only header files you need from Metrowerks are the C++ headers and only if you are using C++.