惆怅南朝石-路书

| | 评论(0)

中国历史上吴-东晋-宋-齐-梁-陈这六朝曾以建康, 也就是今天的南京为都。另外明朝初期曾以南京为都,后期作为陪都。六朝在建康郊区留下了一些墓葬和风格独特的地表石刻。以时间来计,最早的是在公元500年左右,堪称东南大地年代最久远的地上人类遗迹。关于这些朱偰著有《建康兰陵六朝陵墓图考》,文字考究,图表精美。多幅摄影照片撮于民国时期,令人得以一窥当年之状况。唯一可惜者时移世迁,当年阡陌,今为通衢。书中所附地图并地名今多不堪用。

往岁清明、重阳两节,两次携友拜访。清明夜入明孝陵,一窥梅花山孙吴大帝陵;再访甘家巷诸石刻,幕府山下桃花流水菜花黄,更有雇三轮穿猪圈过墓地上山颠终见石麟之美。重阳左近访丹阳、句容、江宁诸石刻,值稻收季节荻花飘摇,叹天地之悠悠,人生之漂渺。

两次拜访,皆赖网络资料,精确可达经纬度。今有同好欲往,乃以取于人而馈于人之念,共享地图。更有交通及背景信息可于路书得之。

另:南京周边尚有南唐二主陵等,市内更有无数古迹,南京大学鼓楼校区那个钟楼地下发现的东晋大墓通常被认为是晋元帝陵,出土文物存南京大学考古与艺术博物馆,我还未曾得以参观。。。随便列了一下,去了那么多次南京竟然还有这么多地方没去过,真是个奇妙的地方。

南京大学考古与艺术博物馆
南京汽车博物馆
南京海洋馆的水母走廊
江宁镇方旗庙石刻(在方旗庙石刻公园内)
牛首山南唐二主陵
栖霞区北家边萧伟墓石刻
还是北家边附近的梁新渝宽侯萧暎墓石刻
中山陵邮局(美龄宫邮局)及体育大学内的中央体育场
浦口火车站(朱自清《背影》)
静海寺《南京条约》史料陈列馆
挹江门江南水师学堂(鲁迅的母校)
法云寺遗址
定林寺遗址(王安石隐居地)
金陵刻经处

毘卢寺(内设南京古都美术馆)
玄奘法师塔
新建的大报恩寺?
桃葉渡 乌衣巷  六条巷(李鸿章祠堂可能没了)
南京地质博物馆
南京云锦博物馆
中山植物园
汤山温泉
阳山碑材
杨柳村
熙园
瞻园
中央旅馆住宿?
六合区的新建筑
汪精卫的还都纪念塔(今和平公园内)
中央美术馆(江苏美术馆)

POSIX on Windows (2) Cygwin

| | 评论(0)

Get blocked on Interix, I turned to Cygwin.

Cygwin

Cygwin platform supports POSIX and unix style sockets APIs, so there is no big effort to get project build. Make sure you installed Cygwin with all "Devel" features selected.

1. Python on Cygwin

Cygwin has a embedded Python and supports calling functions in DLLs with ctypes interface. There are other options to call DLL in Cygwin, while ctypes is the most popular. Make sure install the updated ctypes on cygwin.

1.1 Python call C

Although the "-shared" options generates a DLL in binary, the python in Cygwin ask for names libxxx.so. Make sure the makefile generates library with suffix .so.

1.2 C call Python, Garbage Collection

If we pass a reference of a Python function to C, Cygwin may hang while C call the python function back. The problem is, python may consider the python function is of no use and release the memory. The Python doc talk about this issue and gives a solution to use the Py_XINCREF() and Py_XDECREF() to increase anddecrease the reference number to the python function. This is a kind of too complex, and our C program does not know if the caller is a Python. A better solution is to define a global variable in Python to hold the reference to the python function:

global ref_func = (TO_C_FUNC)pyFunc

and python will not release the memory.

2. Java JNA on Cygwin

Make sure you have the updated jna.jar (JNA, Java Native Access) package before you can proceed. Cygwin does not have a platform specific java, people simply use java for windows. Goto Oracle/Sun website to download and installed jre(java run-time environment) AND jdk (java development kit). Java on Windows recognize *.dll files only, please copy libxyz.so tp xyz.dll and place the DLL file in the same folder of your *.class (the compiled java) file.Since cygwin’s lib*.so is actually dll format, what we need to do is to add a stdcall option g++ -Wl,--add-stdcall-alias -shared -o myDll.dll myNativeCode1.c myNativeCode2.c

JNA(Java native access) enables Java access local C libraries.

However, Java application will hang on calling DLL compiled in Cygwin environment, even with the simplest “hello world” example provided by SUN. A solution mentioned on Cygwin newsgroup is to use minGW compiler with a –mno-cygwin option to generate DLL. Additional option is to generate DLL with MS VC compiler. Both the options make the DLL independent to cygwin1.dll, and that works for the “hello world” example. However, it does not work for us since we rely on cygwin POSIX services.

The problem here is Cygwin library needs a special initialization to setup a 32k(Cygwin doc talks about 4k but 32k is more accurate in current version Cygwin_NT5.1) TLS area at the bottom of the stack for signal emulation(). While we call LoadLibrary from a non-cygwin application (e.g java), the crt start objects in Cygwin was skipped and the TLS area was not reserved.

Cygwin’s doc mentioned a method to build crt0.c to a static lib, then combine it to a Visual C++ application. The cygwin_dll_init() is invoked in crt.c. Unfortunately this way is proved to have problem in spawn new threads.

An applicable method was mentioned here, which is to compile a cygwin local launcher to do the setup and create Java VM. Sun has give an example to invoke Java VM from C, and I write one based on the example. 不过做好以后我杯具地发现在Java的根目录下就有一个src.zip,其中有Launcher源代码。。。好在我的还满好用。

Now try “ldd java_launcher.exe” to make sure the launcher is linked to cygwin1.dll.

Note: while calling the java VM, the classpath must be in Windows format, such as "D:\\\\codes\\\\proj\\\\java". It can be got by execute "cygpath". A example $./java_launcher -classpath `cygpath -w -a ./` myjavatest

3. POSIX local domain sockets (or local connections)

I use connections both in IP sockets or in local sockets. The local sockets links to a file name, eg /tmp/my_connectioons/x1. The path and file are not necessary exists on Linux platform, however, the cygwin implementation asks for path "/tmp/my_connectioons/xyz/" physically exists. I add a function mkdirs() to detect and build the path.

Cygwin will return error with code EINPROGRESS for a non-blocking link while calling connect(). This should be considered as success. Linux simply return success in this case.

4. Perl

Some perl function behavior is kind of difference on Cygwin. eg

$string = `cat filename`

might not get the ouput strings for Perl for Cygwin. I do not know how to solve it yet.

海马出没注意

2010年08月
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    

最近评论

summer: 谈到小泥屋笔记,我有本书叫《喜爱新鲜
蜗牛: 是这个《天真的人類學家之重返多瓦悠蘭
小车: 煤油冰箱在庐山上就有,在那个美庐别墅
海马: 哈?还有第二部啊?叫什么名字来?
蜗牛: 非常喜欢《天真的人类学家:小泥屋笔记
吴隆美: 凤冠情事好像只在电影节放过,没有发行
xd: 能不把我之前的电话给删了啊,留在这也
banfield: 大饱眼福!
朵朵: 暑期慰问的意思
朵朵: Penny就是TBBT里的女主角呀

归档

Powered by Movable Type 4.23-en