Contents Back Forward |
13. Developing Scenarios and Distributing Them |
13.1 Compiling and Linking a CSPL program manually The process of taking source code and transforming it into an executable file consists of two phases: compiling and linking. These phases should be executed automatically by CSPLCompanion, but you may find it useful to have a discussion about manually compiling and linking CSPL programs. Borland 5.5 comes with two programs; a compiler (BCC32.EXE) and a linker (ILINK32.EXE). They have a lot of complex options but you don't need to know most of them. (BTW: I wrote a batch file called CSPLCompanion that should automate this process and you can find its documentation in Appendix A. Anyway, if something goes wrong it would be helpful to know how to compile and link the program manually.) Let's say we have coded our CSPL program in two files called csplclient.cpp and csplclient.h. To compile it I suggest the following command line (remember to copy the cspl.h file into the same directory as csplclient.cpp!): BCC32 -c -w- -W csplclient.cpp     -c option just tells the compiler to compile only and not launch the linker automatically (we need to configure the linker before launching it)     -w- deactivates Warning messages     -W just warns the compiler that the final executable will be a Windows 9x program The output of the compiler will be the file csplclient.obj, an intermediate step between .cpp and .exe Now you need to call the linker on this object file to finish the work (remember to copy cspl.res and cspl.lib in the same directory as csplclient.obj!) Here is the correct command line: ILINK32 /aa c0w32.obj csplclient.obj,csplclient.exe,,cspl.lib import32.lib cw32.lib,,cspl.res (a bit complex, don't you think?)      /aa warns the linker that the final .exe will be a Windows 32 application      c0w32.obj is just an initialization module      csplclient.obj is the name of the object file we obtained through the compiling phase      csplclient.exe is the final name of the executable we will obtain      cspl.lib is obviously the cspl library      import32.lib and cw32.lib are two libraries of the Borland compiler      cspl.res is the resource file for CSPL (it contains information about the CSPL graphic and menu) If all goes well, at the end of the linking phase you'll have your program ready to use ("csplclient.exe" as written in the linker command line). | |
13.2 Releasing CSPL scenarios If you want to use CSPL in your scenarios you'll have to follow these guidelines:
| |
13.3 Security Issue As we saw during the tutorial, the end result of the CSPL process is the creation of an exe file that will be executed on the computers of a lot of civ players. This raises security questions (what if some malicious designer creates an event to format an hard-disk if a particular unit is killed?), resulting in much the same risk you face whenever you run foreign executables on your computer. With the premise that CSPL (and its programmer) cannot be held responsible for any damage caused by the hostile use of CSPL, I want to suggest some ways to avoid this problem:
| |
13.3 Registering CSPL As you can see, I worked very hard to create this library, but I don't want to make you pay for using CSPL. Therefore I've decided to make CSPL "cardware". In other words if you've found this library useful, how about sending me a greetings postcard from your country? Please send them to: Angelo Scotto(No mailbombs please. It is not my personal address, just the address of the post office.) ;-) If for some strange reason you find CSPL useful but you can't send me a postcard don't worry. But please remember to give me credit in your future CSPL programs. |