artefaktur
software engineer &        architecture

 
 
 
 

ACDK Hello World

| Basics | Objects | Types | Hello World |

To get a first impression, here is a simple project written in ACDK.

Content of this chapter:

   The Project Workspace acdk_boot
         Start and configurate a ACDK Project
         HelloACDK Step by Step
         The source code

 The Project Workspace acdk_boot

The Project acdk_boot is provided to demonstrate a basic ACDK project with a modules DLL/SO, an executable and a testing unit. Please refer also to:

!

The sample is a little bit outdated. For sample code, please refer to the acdk_boot package.
 Start and configurate a ACDK Project
  1. First, create a new workspace directory with: $> mkdir /path/to/My/acdk_workspace
  2. Then, create a project directory inside your ACDK workspace.
  3. For source files, make a directory structure like
      "My/acdk_workspace/Project/src/Project"
      and put your source files in the directory "Project/src/Project."
  4. Create the config file "Project.lsp" and edit it in the directory "acdk_workspace/Project/src"
      with your project settings.
  5. Create the makefiles for the gcc compiler with acdklisp or dsp files for MS VC++,
      using the following commands:
    
    $>acdklisp Project.lsp $target #target is the compiler you use
    $>acdklisp Project.lsp linux   #target is linux
    $>acdklisp Project.lsp dsp     #target is MS VC++
    
      The result is "Project.target", which is the makefile for unix systems
      and a projectfile on Win32 platforms.

 HelloACDK Step by Step
For our first project, we need to edit the Project.lsp file. In this example, we will call it HelloACDK.
We create a directory called "HelloACDK", which is the projectdirectory. Then, we need a source directory
"src". We now copy the file "HelloWorld.lsp" from acdk_boot in the source directory and edit it.

$>cp ACDK_HOME/acdk_boot/src/HelloWorld.lsp /path/to/My/acdk_workspace/HelloACDK/src/HelloACDK.lsp
open "HelloACDK.lsp" and edit this file. First, you have to change the projectname in line 28.

28: (setg acdkmake-project-name  "HelloWorld") ;;; replace this name
to

28: (setg acdkmake-project-name  "HelloACDK") ;;; replace this name
In line 33, you are able to change the binary directory for the compiler and default, is the path to
the acdk binary directory "ACDK_HOME/bin". Change line 33 from

33: (setg acdkmake-project-exec-dir (s+ acdk-home "/bin" (if ...
to

33: (setg acdkmake-project-exec-dir (s+ "My/acdk_workspace/bin" (if ...
In line 62, we change the path to source files for our project.

62: "acdk/HelloWorld.cpp"

62: "HelloACDK/HelloACDK.cpp"
Currently, we have the file HelloACDK.cpp. We now start acdklisp using the following command.

$>acdklisp HelloACDK.lsp linux #target is linux
$>acdklisp HelloACDK.lsp dsp   #target is MS VC++
When acdklisp is completed, we find the file "HelloACDK.linux" in the "src" directory, which
is the makefile for linux and "HelloACDK.dsp," the projectfile for VC++. We are now able to compile the HelloACDK
project under linux with

$>make -f HelloACDK.linux
and under Windows with MS VC++. You find binary files in the directory, which
you have entered into the file of "HelloACDK.lsp" in line 33.
 The source code
You can find the source file in the acdk_tutorial directory.

// including ACDK-declarations
#include <acdk.h>
// include needed ACDK-Classes
#include <acdk/lang/System.h>
#include <acdk/lang/StringBuffer.h>

// import namespace
using namespace acdk::lang;

ACDK_DECL_CLASS(HelloACDK);

class HelloACDK
: extends ::acdk::lang::Object
{
public:
  static int acdkmain(IN(RStringArray) args);
  void getMessage();
  

};

void
HelloACDK::getMessage()
{
  System::out->println("Hello First User ;-)");
}

int
HelloACDK::acdkmain(RStringArray args)
{
  RHelloACDK hello = new HelloACDK();
  hello->getMessage();
  return 0;
}

int main(int argc, char* argv[], char** envptr)
{
  // enter acdk's world
  return acdk::lang::System::main(HelloACDK::acdkmain, argc, argv, envptr);
}

 < prevTutorial(4 / 4)

 
Last modified 2005-05-08 22:19 by SYSTEM By Artefaktur, Ing. Bureau Kommer