Computer Science
ACE : mpc.pl, mwc.pl 설명서
졸리운_곰
2010. 10. 15. 18:07
A Short Tutorial on How to Use mpc.pl and mwc.pl
This tutorial shows how to create a small workspace with 3 projects. The first project is a "hello world" program. The second project is a shared library which prints "hello from hello_dll_project.cpp". The third project is in another directory, and it prints "Hello Sailor" and then calls the function in the shared library. I compile these projects with make, nmake and with visual studio 8.0.
Installation
If you need to install for linux go here before you try to run mpc.Basic Terms
Go here for some basic notes on mpc, mwc and syntax.Download Example
You can download the sample files in zip format or tar.gz format.This is the directory structure and its basic contents:
foo/ # the main directory
foo/hello_project # contains hello and hello_dll projects
foo/hello_sailor_project # contains hello_sailor project
foo/include # contains include file
foo/bin # contains nothing untill projects are built
./sample_workspace.mwc
This is a sample workspace. It consist of 3 different projects in 2 directories../hello_project/hello_project.mpc
This is a project that illustrates the basics of naming an executable, installing it, specifying the include paths, specifying the source files and specifying the header files../hello_project/hello_dll_project.mpc
This is a shared library or dll project. It illustrates how to install in differnt directories for different OS's with the specific command. Illustrates how to pass compiler flags for Microsoft declspec(dllimport) and declspec(dllexport) specifications. The HELLODLL macro interacts with hello.h to generate these statements. It illustrates how to include a dllmain function, for Microsoft targets.For the linux target OS, the ouput is put into /usr/local/cvs-user/lib which is available for all users to access. This directory is included in /etc/ld.so.conf. See here for instructions on how to set this up in gentoo.
./hello_sailor_project/hello_sailor_project.mpc
This illustrates the after command which makes this project dependent upon hello_dll. It also illustratetes linking which is conditional upon the operating system../hello_project/hello.cpp
This is the classic hello world program, except that it includes a file hello.h../include/hello.h
This is a header file full of macros, for specifying functions, and their linkage flags, STDCALL, dllexport etc. For linux all the Microsoft giberish disappears../hello_project/hello_dll.cpp
This file has one function, which says "hello from hello_dll.cpp". It has the Microsoft name manglers in its declaration../hello_project/dll.main.cpp
This file contains the Microsoft specific, dllmain function../hello_sailor_project/hello_sailor.cpp
This program illustrates calling a function in a shared library.Command line syntax
cd foo#to create for make:
mwc.pl sample_workspace.mwc
#to create for nmake
mwc.pl sample_workspace.mwc -type nmake
#to create for vc8
mwc.pl sample_workspace.mwc -type vc8
Configuration Options
When building for Microsoft platforms there are several different options for compiling and linking. These options can be found by opening one of the makefiles for a specific project, for example Makefile.hello.mak. The options are listed toward the beginning of the file. For example, Makefiles generated for nmake have the following options:
- "Win32 Debug"
- "Win32 Release"
- "Win32 Static Debug"
- "Win32 Static Release"