Unicon: Compile

From The Uniform Server Wiki
Jump to navigation Jump to search

MPG UniCenter

MPG UniCenter

Unicon

Compile Unicon

Unicon is written in C and complied with lcc-win32 a powerful but easy to use program. These instructions provide a step-by-step guide to set-up a clean project on lcc-win32.

Note: This page lcc-win32 introduction is worth looking at before reading the following.

Create a new project

I have assumed lcc-win32 is installed on drive E, your location will be different just subsitute the appropricate drive.

  1. Create new folder named unicon located in the projects folder: E:\lcc\projects\unicon
  2. Start lcc-win32
  3. Close any open project: Projects > Close
  4. Create new project: File > New > Projects
  5. In Definition of new project window, enter the following:
    1. Name: unicon
    2. Source: Click brows button navigate to and select project folder unicon (as created in step 1)
    3. Output directory: This is automatically filled in for you.
    4. Type of project: Click Windows application radio button
    5. Click create
  6. Do you want to use wizzard: Click yes (Note: steps 7 to 14 are click-through)
  7. Application characteristics: Click Ok
  8. Class definition: Click Next
  9. Generate code for window creation: Click Finish
  10. lcc wizard: Click OK
  11. Compiler settings: Click Next
  12. Linker settings: Click Next
  13. Debugger settings: Click Finish
  14. Close lcc-win32: File > Quit

Top

Add project files

From the folder where you extracted unicon_project.exe copy the following files:

  • unicon.c
  • Logo.bmp
  • uslogo.ico

to lcc-win32 project folder E:\lcc\projects\unicon

(Note Drive letter will be different depending where you installed lcc-win32)

Top

Add images to the resource file

  1. Start lcc-win32 project automatically opens
  2. Select: Design > Open/New
  3. Select: uniconres.h click Open
  4. Select: Design > New > icon
    1. Click brows, select uslogo.ico, Click Open
    2. Change Identity to: uslogo
    3. Check Set relative path mox
    4. Click OK
  5. Select: Design > New > bitmap
    1. Click brows, select Logo.bmp, Click Open
    2. Change Identity to: logo
    3. Check Set relative path box
    4. Click OK
  6. Select: File > Save all
    A pop-up is displayed “file has changed reload from disk”: Click Yes
  7. Select: Compiler > Make
    This will display a “missing libraries” pop-up click Add libs (button bottom right)
  8. Re-run make: Compiler > Make
    Note the message unicon built successfully.
  9. Select: Compiler > Execute unicon.exe

The program will run and display a pop-up "Apache file problem" this confirms program was compiled and runs successfully.

Click OK, time to add Uniform Server to the project.

Top

Add Uniform Server to project

  1. Extract a copy of Uniform Server 3.5 to any folder.
  2. Open folder “Uniform Server” and copy all it's content to folder E:\lcc\projects\unicon\lcc

While in folder E:\lcc\projects\unicon\lcc delete the following files these are not required:

  • Server_Start.bat
  • Stop.bat
  • UniController.exe
  • Disk Start.vbs .

Do NOT delete “udrive” it contains Uniform Server.

You can now run unicon.exe either directly or from lcc-win32 (Compiler > Execute unicon.exe)

Note: Size of unicon.exe is large (approx 184K) this is because it contains debug information. After you have completed any modifications and tested change the compiler settings as follows:

  1. Project > Configuration
  2. Click Compiler tab
  3. Un-check the “Generate debug info” box
  4. Click OK a pop-up is displayed “Rebuild make file” click Yes
  5. Re-run make: Compiler > Make
  6. Note the size of unicon.exe reduces to about 67K

To further reduce size, while in Project > Configuration > Compiler tab

  • Enable: Optimize
  • Enable: Use Pentium pro instructions
  • Enable: Eliminate unused assignments.

The reduction is small but still worth having.

Top

Summary

The above provides a complete development environment where you can modify the existing utility or create a new one.

Remainder of this series provides code snippets, which will help in understanding the utility’s source code.

Top


Ric