-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.zxid-win32
137 lines (99 loc) · 6.02 KB
/
README.zxid-win32
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
README.zxid-win32
#################
<<cvsid: $Id: README.zxid-win32,v 1.3 2009-10-16 13:36:33 sampo Exp $>>
<<author: Sampo Kellomaki ([email protected])>>
As of version 0.11, January 2007, the Windows port is experimental.
Only well researched questions, please.
Right now the following has been accomplished
1. Compiles cleanly (xmingw cross compile)
2. CGI executables such as zxid and zxidhlo are produced (but not tested)
3. zxid.dll is produced
4. zxidjni.dll is produced
*Todo*
* Call zxid.dll from C# (non COM route)
* Make zxid.dll into COM object and call it from C#; try
make csharpzxid TARGET=mingw
* Test and debug that the zxid_simple() API really works on Windows
1 Building
==========
Current approach is to use the MinGW environment. Cross compilation
on Linux host and MinGW target is best tested. Native compile
with MinGW may work, but author is not able to test this combination.
Nobody has tried compilation using Visual C, reports welcome.
Generally you would proceed as follows
make default zxid.dll TARGET=xmingw # Cross compile
or
make default zxid.dll TARGET=mingw # Native compile
There is no make install, thus you will have to manually
put things in right places and create /var/zxid directory
hierarchy (what would be appropriate place for this in Windows?)
ZXID depends on libcurl, openssl, and zlib. For best results
you should compile these yourself and link them statically into
the binaries and dll. It may be possible to use binaries
from other sources (such as doenload sites of the respective
projects), but this has not been tested. Cygwin packaged
versions of these binaries are reported to work.
2 Binary distribution
=====================
I distribute an experimental binary package. You can find
it in http://zxid.org/zxid-0.34-win32-bin.zip (substitute release number).
It was cross compiled and probably works on Windows 2000. I do not have
resources to test more widely.
2 Calling ZXID from C#
======================
<<code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace HelloZXID
{
class Program
{
[DllImport("zxid.dll")]
static extern int zxid_version();
static void Main(string[] args)
{
int a = zxid_version();
Console.WriteLine("ZXID version is --- " + a.ToString());
Console.ReadLine();
}
}
}
>>
<<EOF: >>
COM
===
regsvr32 (register the DLL as COM)
The DLL should have function called
DllRegisterServer()
C# Calling
==========
* Turning code "unsafe"
* pinvoke
-----
/apps/gcc/mingw/bin/i586-pc-mingw32-gcc -g -fmessage-length=0 -Wno-unused-label -Wno-unknown-pragmas -fno-strict-aliasing -mno-cygwin -DUSE_ZXID -DDISA_MINI_HTTPD_BLOAT -DUSE_CURL -DUSE_OPENSSL -DUSE_PTHREAD -pthread -DZXID_LIBNAME='" libe2eta ix86-32 ([email protected])"' -DZXID_CONF_PATH='"/var/zxid/zxid.conf"' -DUSE_AKBOX_FN=1 -DMINGW -DUSE_LOCK=dummy_no_flock -DCURL_STATICLIB -D_REENTRANT -DDEBUG -DMUTEX_DEBUG=1 -I. -I/home/sampo/zxid -I/apps/gcc/mingw/sysroot/include -I/apps/gcc/mingw/sysroot/include -I/apps/include -I/usr/include/apache2 -I/usr/include/apr-1.0 -c -o zxpw.o zxpw.c
i586-pc-mingw32-gcc: unrecognized option `-pthread'
In file included from /apps/include/curl/curl.h:34,
from zxid.h:36,
from zxpw.c:33:
/apps/include/curl/curlbuild.h:152:26: sys/socket.h: No such file or directory
In file included from /apps/include/curl/curl.h:34,
from zxid.h:36,
from zxpw.c:33:
/apps/include/curl/curlbuild.h:165: error: syntax error before "curl_socklen_t"
/apps/include/curl/curlbuild.h:165: warning: data definition has no type or storage class
make: *** [zxpw.o] Error 1
# fix: remove -shared
/apps/gcc/mingw/bin/i586-pc-mingw32-gcc -c -o zxidjava/zxid_wrap.o -I /usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -g -fmessage-length=0 -Wno-unused-label -Wno-unknown-pragmas -fno-strict-aliasing -mno-cygwin -DUSE_ZXID -DDISA_MINI_HTTPD_BLOAT -DUSE_CURL -DUSE_OPENSSL -DUSE_PTHREAD -pthread -DZXID_LIBNAME='" libe2eta ix86-32 ([email protected])"' -DZXID_CONF_PATH='"/var/zxid/zxid.conf"' -DUSE_AKBOX_FN=1 -DMINGW -DUSE_LOCK=dummy_no_flock -DCURL_STATICLIB -D_REENTRANT -DDEBUG -DMUTEX_DEBUG=1 -I. -I/home/sampo/zxid -I/apps/gcc/mingw/sysroot/include -I/apps/gcc/mingw/sysroot/include -I/apps/gcc/mingw/sysroot/include -I/apps/gcc/mingw/sysroot/include -I/apps/gcc/mingw/sysroot/srclib/apr-util/include zxidjava/zxid_wrap.c
i586-pc-mingw32-gcc: unrecognized option `-pthread'
zxidjava/zxid_wrap.c: In function `Java_zxidjava_zxidjniJNI_zxid_1bus_1url_1fd_1set':
zxidjava/zxid_wrap.c:14851: warning: assignment makes pointer from integer without a cast
/apps/gcc/mingw/bin/i586-pc-mingw32-gcc -o zxidjava/zxidjni.dll -Wl,--add-stdcall-alias -shared --export-all-symbols -Wl,-whole-archive -Wl,-no-undefined -Wl,--enable-runtime-pseudo-reloc -Wl,--allow-multiple-definition zxidjava/zxid_wrap.o -L. -lzxid -mconsole -L/apps/gcc/mingw/sysroot/lib -L/apps/gcc/mingw/sysroot/lib -lcurl -lssl -lcrypto -lz -lwinmm -lwsock32 -lgdi32 -lkernel32 -Wl,-no-whole-archive
zxidjava/zxid_wrap.o: In function `Java_zxidjava_zxidjniJNI_zx_1str_1n_1get':/home/sampo/zxid/zxidjava/zxid_wrap.c:1276: undefined reference to `pthread_self'
zxidjava/zxid_wrap.o: In function `Java_zxidjava_zxidjniJNI_new_1zx_1str':/home/sampo/zxid/zxidjava/zxid_wrap.c:1394: undefined reference to `pthread_self'
zxidjava/zxid_wrap.o: In function `Java_zxidjava_zxidjniJNI_zx_1attr_1s_1g_1get':/home/sampo/zxid/zxidjava/zxid_wrap.c:1446: undefined reference to `pthread_self'
zxidjava/zxid_wrap.o: In function `Java_zxidjava_zxidjniJNI_zx_1elem_1s_1g_1get':/home/sampo/zxid/zxidjava/zxid_wrap.c:1600: undefined reference to `pthread_self'
zxidjava/zxid_wrap.o: In function `Java_zxidjava_zxidjniJNI_zx_1ref_1str':/home/sampo/zxid/zxidjava/zxid_wrap.c:2058: undefined reference to `pthread_self'
zxidjava/zxid_wrap.o:/home/sampo/zxid/zxidjava/zxid_wrap.c:2098: more undefined references to `pthread_self' follow
make: *** [zxidjava/zxidjni.dll] Error 1