(一)nimlang web開發 hello world

開發環境:html

一:nim-0.13.0_x64.exe (http://nim-lang.org/download.html)編程

二:Mingw-w64windows

三:Aporia IDE.net

       其實,你在安裝nim-0.13.0_x64.exe過程當中,安裝程序會問你想安裝Mingw-w64和Aporia IDE不。你能夠選擇性安裝。(Aporia IDE的貌似在windows下,bug多 點。。)code

 

先從最簡單的" hello world"開始。htm

hw.nim開發

echo( "Hello World!!")

而後, nim c hw.nim 編程成本地程序。get

nim的編譯器會自動生成一個hw.c的文件。如下是部分hw.c的代碼。編譯器

/* Generated by Nim Compiler v0.13.0 */
/*   (c) 2015 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Windows, amd64, gcc */
/* Command for C compiler:
   gcc.exe -c  -w  -IC:\Nim\lib -o c:\nimtest\nimcache\hw.o c:\nimtest\nimcache\hw.c */
#define NIM_INTBITS 64

#include "nimbase.h"
#include <stdio.h>
typedef struct TGenericSeq TGenericSeq;
typedef struct NimStringDesc NimStringDesc;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, setStackBottom)(void* thestackbottom);
static N_INLINE(void, nimFrame)(TFrame* s);
N_NOINLINE(void, stackoverflow_22201)(void);
static N_INLINE(void, popFrame)(void);
NIM_EXTERNC N_NOINLINE(void, systemInit000)(void);
NIM_EXTERNC N_NOINLINE(void, systemDatInit000)(void);
NIM_EXTERNC N_NOINLINE(void, hwInit000)(void);
NIM_EXTERNC N_NOINLINE(void, hwDatInit000)(void);
STRING_LITERAL(TMP142, "Hello World!!", 13);
extern TFrame* frameptr_19436;

static N_INLINE(void, initStackBottomWith)(void* locals) {
	setStackBottom(locals);
}
void PreMainInner() {
	systemInit000();
	hwDatInit000();
}

void PreMain() {
	void (*volatile inner)();
	systemDatInit000();
	inner = PreMainInner;
	initStackBottomWith((void *)&inner);
	(*inner)();
}

運行的結果:it

相關文章
相關標籤/搜索