]> pere.pagekite.me Git - homepage.git/blob - linux/sane/sane-win32.diff
Generated.
[homepage.git] / linux / sane / sane-win32.diff
1 diff -ru sane-pre1.01-4/ChangeLog sane-pre1.01-4-pere/ChangeLog
2 --- sane-pre1.01-4/ChangeLog Sun Apr 4 01:17:20 1999
3 +++ sane-pre1.01-4-pere/ChangeLog Fri Apr 9 14:25:28 1999
4 @@ -1,3 +1,8 @@
5 +1999-04-08 Petter Reinholdtsen <pere@td.org.uit.no>
6 + * include/sane/config.h.in include/sane/sane.h backend/dll.c
7 + backend/net.c: Added initial Win32 patches. Win32 dll support
8 + should be complete.
9 +
10 1999-04-03 David Mosberger-Tang <David.Mosberger@acm.org>
11
12 * include/sane/sanei_debug.h: Define sanei_debug_BACKEND_NAME only
13 diff -ru sane-pre1.01-4/backend/dll.c sane-pre1.01-4-pere/backend/dll.c
14 --- sane-pre1.01-4/backend/dll.c Sun Feb 28 00:51:37 1999
15 +++ sane-pre1.01-4-pere/backend/dll.c Fri Apr 9 01:20:39 1999
16 @@ -54,6 +54,9 @@
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 +#ifdef HAVE_WINDOWS_H
21 +# include <windows.h>
22 +#endif
23
24 #if defined(HAVE_DLOPEN) && defined(HAVE_DLFCN_H)
25 # include <dlfcn.h>
26 @@ -68,12 +71,29 @@
27 # ifndef RTLD_LAZY
28 # define RTLD_LAZY 1
29 # endif
30 +# if defined(_AIX)
31 +# define DLL_PATH_ENV "LIBPATH"
32 +# else
33 +# define DLL_PATH_ENV "LD_LIBRARY_PATH"
34 +# endif
35 +# define DLL_PATH_SEPARATOR ":"
36 +# define DLL_SLASH "/"
37 +# define DLL_NAME "libsane-%s.so." STRINGIFY(V_MAJOR)
38 # define HAVE_DLL
39 -#endif
40 -
41 +#elif defined (HAVE_SHL_LOAD) && defined(HAVE_DL_H)
42 /* HP/UX DLL support */
43 -#if defined (HAVE_SHL_LOAD) && defined(HAVE_DL_H)
44 # include <dl.h>
45 +# define DLL_PATH_ENV "SHLIB_PATH"
46 +# define DLL_PATH_SEPARATOR ":"
47 +# define DLL_SLASH "/"
48 +# define DLL_NAME "libsane-%s.sl." STRINGIFY(V_MAJOR)
49 +# define HAVE_DLL
50 +#elif defined(HAVE_LOADLIBRARY)
51 +/* Win32 */
52 +# define DLL_PATH_ENV "PATH"
53 +# define DLL_PATH_SEPARATOR ";"
54 +# define DLL_SLASH "\\"
55 +# define DLL_NAME "sane%s.dll"
56 # define HAVE_DLL
57 #endif
58
59 @@ -230,24 +250,11 @@
60 load (struct backend *be)
61 {
62 #ifdef HAVE_DLL
63 - int mode = 0;
64 char *funcname, *src, *dir, *path = 0;
65 char libname[PATH_MAX];
66 int i;
67 FILE *fp = 0;
68
69 -#if defined(HAVE_DLOPEN)
70 -# define PREFIX "libsane-"
71 -# define POSTFIX ".so.%u"
72 - mode = getenv ("LD_BIND_NOW") ? RTLD_NOW : RTLD_LAZY;
73 -#elif defined(HAVE_SHL_LOAD)
74 -# define PREFIX "libsane-"
75 -# define POSTFIX ".sl.%u"
76 - mode = BIND_DEFERRED;
77 -#else
78 -# error "Tried to compile unsupported DLL."
79 -#endif /* HAVE_DLOPEN */
80 -
81 DBG(1, "loading backend %s\n", be->name);
82
83 /* initialize all ops to "unsupported" so we can "use" the backend
84 @@ -260,28 +267,22 @@
85 dir = STRINGIFY(LIBDIR);
86 while (dir)
87 {
88 - snprintf (libname, sizeof (libname), "%s/"PREFIX"%s"POSTFIX,
89 - dir, be->name, V_MAJOR);
90 + snprintf (libname, sizeof (libname), "%s" DLL_SLASH DLL_NAME,
91 + dir, be->name);
92 fp = fopen (libname, "r");
93 if (fp)
94 break;
95
96 if (!path)
97 {
98 - path = getenv ("LD_LIBRARY_PATH");
99 - if (!path)
100 - {
101 - path = getenv ("SHLIB_PATH"); /* for HP-UX */
102 - if (!path)
103 - path = getenv ("LIBPATH"); /* for AIX */
104 - }
105 + path = getenv (DLL_PATH_ENV);
106 if (!path)
107 break;
108
109 path = strdup (path);
110 src = path;
111 }
112 - dir = strsep (&src, ":");
113 + dir = strsep (&src, DLL_PATH_SEPARATOR);
114 }
115 if (path)
116 free (path);
117 @@ -294,9 +295,11 @@
118 DBG(2, "dlopen()ing `%s'\n", libname);
119
120 #ifdef HAVE_DLOPEN
121 - be->handle = dlopen (libname, mode);
122 + be->handle = dlopen (libname, getenv ("LD_BIND_NOW") ? RTLD_NOW : RTLD_LAZY);
123 #elif defined(HAVE_SHL_LOAD)
124 - be->handle = (shl_t)shl_load (libname, mode, 0L);
125 + be->handle = (shl_t)shl_load (libname, BIND_DEFERRED, 0L);
126 +#elif defined(HAVE_LOADLIBRARY)
127 + be->handle = LoadLibrary(libname);
128 #else
129 # error "Tried to compile unsupported DLL."
130 #endif /* HAVE_DLOPEN */
131 @@ -319,6 +322,8 @@
132 op = (void *(*)()) dlsym (be->handle, funcname + 1);
133 #elif defined(HAVE_SHL_LOAD)
134 shl_findsym ((shl_t*)&(be->handle), funcname + 1, TYPE_UNDEFINED, &op);
135 +#elif defined(HAVE_LOADLIBRARY)
136 + op = GetProcAddress(be->handle, funcname + 1);
137 #else
138 # error "Tried to compile unsupported DLL."
139 #endif /* HAVE_DLOPEN */
140 @@ -331,6 +336,8 @@
141 op = (void *(*)()) dlsym (be->handle, funcname);
142 #elif defined(HAVE_SHL_LOAD)
143 shl_findsym (be->handle, funcname, TYPE_UNDEFINED, &op);
144 +#elif defined(HAVE_LOADLIBRARY)
145 + op = GetProcAddress(be->handle, funcname);
146 #else
147 # error "Tried to compile unsupported DLL."
148 #endif /* HAVE_DLOPEN */
149 @@ -343,8 +350,6 @@
150
151 return SANE_STATUS_GOOD;
152
153 -# undef PREFIX
154 -# undef POSTFIX
155 #else /* HAVE_DLL */
156 DBG(1, "load: ignoring attempt to load `%s'; compiled without dl support\n",
157 be->name);
158 @@ -379,7 +384,7 @@
159 return SANE_STATUS_GOOD;
160 }
161
162 -SANE_Status
163 +DLLEXPORT SANE_Status DLLCALL
164 sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
165 {
166 char backend_name[PATH_MAX];
167 @@ -425,7 +430,7 @@
168 return SANE_STATUS_GOOD;
169 }
170
171 -void
172 +DLLEXPORT void DLLCALL
173 sane_exit (void)
174 {
175 struct backend *be, *next;
176 @@ -441,15 +446,18 @@
177 (*be->op[OP_EXIT]) ();
178 #ifdef HAVE_DLL
179
180 -#ifdef HAVE_DLOPEN
181 if (be->handle)
182 - dlclose (be->handle);
183 + {
184 +#ifdef HAVE_DLOPEN
185 + dlclose (be->handle);
186 #elif defined(HAVE_SHL_LOAD)
187 - if (be->handle)
188 - shl_unload(be->handle);
189 + shl_unload(be->handle);
190 +#elif defined(HAVE_LOADLIBRARY)
191 + FreeLibrary(be->handle);
192 #else
193 # error "Tried to compile unsupported DLL."
194 #endif /* HAVE_DLOPEN */
195 + }
196
197 #endif /* HAVE_DLL */
198 }
199 @@ -468,7 +476,7 @@
200 (assuming you know the name of the backend/device). This is
201 appropriate for the command-line interface of SANE, for example.
202 */
203 -SANE_Status
204 +DLLEXPORT SANE_Status DLLCALL
205 sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only)
206 {
207 static int devlist_size = 0, devlist_len = 0;
208 @@ -549,7 +557,7 @@
209 return SANE_STATUS_GOOD;
210 }
211
212 -SANE_Status
213 +DLLEXPORT SANE_Status DLLCALL
214 sane_open (SANE_String_Const full_name, SANE_Handle * meta_handle)
215 {
216 const char *be_name, *dev_name;
217 @@ -619,7 +627,7 @@
218 return SANE_STATUS_GOOD;
219 }
220
221 -void
222 +DLLEXPORT void DLLCALL
223 sane_close (SANE_Handle handle)
224 {
225 struct meta_scanner *s = handle;
226 @@ -629,7 +637,7 @@
227 free (s);
228 }
229
230 -const SANE_Option_Descriptor *
231 +DLLEXPORT const SANE_Option_Descriptor * DLLCALL
232 sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
233 {
234 struct meta_scanner *s = handle;
235 @@ -638,7 +646,7 @@
236 return (*s->be->op[OP_GET_OPTION_DESC]) (s->handle, option);
237 }
238
239 -SANE_Status
240 +DLLEXPORT SANE_Status DLLCALL
241 sane_control_option (SANE_Handle handle, SANE_Int option,
242 SANE_Action action, void *value, SANE_Word * info)
243 {
244 @@ -650,7 +658,7 @@
245 value, info);
246 }
247
248 -SANE_Status
249 +DLLEXPORT SANE_Status DLLCALL
250 sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
251 {
252 struct meta_scanner *s = handle;
253 @@ -659,7 +667,7 @@
254 return (long) (*s->be->op[OP_GET_PARAMS]) (s->handle, params);
255 }
256
257 -SANE_Status
258 +DLLEXPORT SANE_Status DLLCALL
259 sane_start (SANE_Handle handle)
260 {
261 struct meta_scanner *s = handle;
262 @@ -668,7 +676,7 @@
263 return (long) (*s->be->op[OP_START]) (s->handle);
264 }
265
266 -SANE_Status
267 +DLLEXPORT SANE_Status DLLCALL
268 sane_read (SANE_Handle handle, SANE_Byte * data, SANE_Int max_length,
269 SANE_Int * length)
270 {
271 @@ -679,7 +687,7 @@
272 return (long) (*s->be->op[OP_READ]) (s->handle, data, max_length, length);
273 }
274
275 -void
276 +DLLEXPORT void DLLCALL
277 sane_cancel (SANE_Handle handle)
278 {
279 struct meta_scanner *s = handle;
280 @@ -688,7 +696,7 @@
281 (*s->be->op[OP_CANCEL]) (s->handle);
282 }
283
284 -SANE_Status
285 +DLLEXPORT SANE_Status DLLCALL
286 sane_set_io_mode (SANE_Handle handle, SANE_Bool non_blocking)
287 {
288 struct meta_scanner *s = handle;
289 @@ -697,7 +705,7 @@
290 return (long) (*s->be->op[OP_SET_IO_MODE]) (s->handle, non_blocking);
291 }
292
293 -SANE_Status
294 +DLLEXPORT SANE_Status DLLCALL
295 sane_get_select_fd (SANE_Handle handle, SANE_Int * fd)
296 {
297 struct meta_scanner *s = handle;
298 diff -ru sane-pre1.01-4/backend/net.c sane-pre1.01-4-pere/backend/net.c
299 --- sane-pre1.01-4/backend/net.c Sat Apr 3 06:43:01 1999
300 +++ sane-pre1.01-4-pere/backend/net.c Fri Apr 9 13:02:41 1999
301 @@ -63,6 +63,26 @@
302 #include <netinet/in.h>
303 #include <netdb.h> /* OS/2 needs this _after_ <netinet/in.h>, grrr... */
304
305 +#ifdef HAVE_WINDOWS_H
306 +# define HAVE_WIN32
307 +# include <windows.h>
308 +# include <io.h>
309 +# include <winsock.h>
310 +# include <malloc.h>
311 +# define NETREAD recv
312 +# define NETWRITE send
313 +# define NETCLOSE closesocket
314 +# warning "Username is hardcoded!"
315 +# define USERNAME "hardcoded"
316 +# define SOCKET_OK(s) (s != INVALID_SOCKET)
317 +#else
318 +# define NETREAD read
319 +# define NETWRITE write
320 +# define NETCLOSE close
321 +# define USERNAME getlogin()
322 +# define SOCKET_OK(s) (s >= 0)
323 +#endif
324 +
325 #include <sane/sane.h>
326 #include <sane/sanei.h>
327 #include <sane/sanei_net.h>
328 @@ -149,7 +169,7 @@
329 }
330
331 dev->ctl = socket (dev->addr.sa_family, SOCK_STREAM, 0);
332 - if (dev->ctl < 0)
333 + if (!SOCKET_OK(dev->ctl))
334 {
335 DBG(1, "connect_dev: failed to obtain socket (%s)\n", strerror (errno));
336 dev->ctl = -1;
337 @@ -188,13 +208,13 @@
338
339 sanei_w_init (&dev->wire, sanei_codec_bin_init);
340 dev->wire.io.fd = dev->ctl;
341 - dev->wire.io.read = read;
342 - dev->wire.io.write = write;
343 + dev->wire.io.read = NETREAD;
344 + dev->wire.io.write = NETWRITE;
345
346 /* exchange version codes with the server: */
347 req.version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR,
348 SANEI_NET_PROTOCOL_VERSION);
349 - req.username = getlogin ();
350 + req.username = USERNAME;
351 sanei_w_call (&dev->wire, SANE_NET_INIT,
352 (WireCodecFunc) sanei_w_init_req, &req,
353 (WireCodecFunc) sanei_w_init_reply, &reply);
354 @@ -229,7 +249,7 @@
355 return SANE_STATUS_GOOD;
356
357 fail:
358 - close (dev->ctl);
359 + NETCLOSE (dev->ctl);
360 dev->ctl = -1;
361 return SANE_STATUS_IO_ERROR;
362 }
363 @@ -261,7 +281,7 @@
364 s->hw->auth_active = 0;
365 if (s->data >= 0)
366 {
367 - close (s->data);
368 + NETCLOSE (s->data);
369 s->data = -1;
370 }
371 return SANE_STATUS_CANCELLED;
372 @@ -294,7 +314,7 @@
373 }
374 }
375
376 -SANE_Status
377 +DLLEXPORT SANE_Status DLLCALL
378 sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
379 {
380 char device_name[PATH_MAX];
381 @@ -305,6 +325,27 @@
382
383 DBG_INIT();
384
385 +#ifdef HAVE_WIN32
386 + {
387 + WSADATA wsadata;
388 + WORD wVer;
389 +
390 + mVer = MAKEWORD(1,1);
391 + if (0 != WSAStartup(wVer, &wsadata))
392 + {
393 + DBG(1, "WSAStartup(1.1, ptr) failed.");
394 + return SANE_STATUS_UNSUPPORTED; /* XXX check this error value */
395 + }
396 +
397 + /* Check WINSOCK.DLL version */
398 + if (1 != LOBYTE(wsadata.mVersion) || 1 != HIBYTE(wsadata.mVersion))
399 + {
400 + DBG(1, "WINSOCK.DLL does not support v1.1.");
401 + return SANE_STATUS_UNSUPPORTED; /* XXX check this error value */
402 + }
403 + }
404 +#endif
405 +
406 auth_callback = authorize;
407
408 if (version_code)
409 @@ -318,7 +359,7 @@
410 saned_port = htons (6566);
411 DBG(1,
412 "init: could not find `sane' service (%s); using default port %d\n",
413 - strerror (errno), htons (saned_port));
414 + strerror (errno), htons ((unsigned short)saned_port));
415 }
416
417 fp = sanei_config_open (NET_CONFIG_FILE);
418 @@ -354,7 +395,7 @@
419 return SANE_STATUS_GOOD;
420 }
421
422 -void
423 +DLLEXPORT void DLLCALL
424 sane_exit (void)
425 {
426 Net_Scanner *handle, *next_handle;
427 @@ -382,10 +423,19 @@
428 sanei_w_call (&dev->wire, SANE_NET_EXIT,
429 (WireCodecFunc) sanei_w_void, 0,
430 (WireCodecFunc) sanei_w_void, 0);
431 - close (dev->ctl);
432 + NETCLOSE (dev->ctl);
433 }
434 free (dev);
435 }
436 +#ifdef HAVE_WIN32
437 + /* Release Windows socket DLL */
438 + if (SOCKET_ERROR == WSACleanup())
439 + if (WSAEINPROGRESS == WSAGetLastError())
440 + {
441 + WSACancelBlockingCall();
442 + WSACleanup();
443 + }
444 +#endif
445 }
446
447 /* Note that a call to get_devices() implies that we'll have to
448 @@ -394,7 +444,7 @@
449 backend/device). This is appropriate for the command-line
450 interface of SANE, for example.
451 */
452 -SANE_Status
453 +DLLEXPORT SANE_Status DLLCALL
454 sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only)
455 {
456 static int devlist_size = 0, devlist_len = 0;
457 @@ -500,7 +550,7 @@
458 return SANE_STATUS_GOOD;
459 }
460
461 -SANE_Status
462 +DLLEXPORT SANE_Status DLLCALL
463 sane_open (SANE_String_Const full_name, SANE_Handle * meta_handle)
464 {
465 SANE_Open_Reply reply;
466 @@ -609,7 +659,7 @@
467 return SANE_STATUS_GOOD;
468 }
469
470 -void
471 +DLLEXPORT void DLLCALL
472 sane_close (SANE_Handle handle)
473 {
474 Net_Scanner *prev, *s;
475 @@ -636,11 +686,11 @@
476 (WireCodecFunc) sanei_w_word, &s->handle,
477 (WireCodecFunc) sanei_w_word, &ack);
478 if (s->data >= 0)
479 - close (s->data);
480 + NETCLOSE (s->data);
481 free (s);
482 }
483
484 -const SANE_Option_Descriptor *
485 +DLLEXPORT const SANE_Option_Descriptor * DLLCALL
486 sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
487 {
488 Net_Scanner *s = handle;
489 @@ -658,7 +708,7 @@
490 return s->opt.desc[option];
491 }
492
493 -SANE_Status
494 +DLLEXPORT SANE_Status DLLCALL
495 sane_control_option (SANE_Handle handle, SANE_Int option,
496 SANE_Action action, void *value, SANE_Word * info)
497 {
498 @@ -733,7 +783,7 @@
499 return status;
500 }
501
502 -SANE_Status
503 +DLLEXPORT SANE_Status DLLCALL
504 sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
505 {
506 Net_Scanner *s = handle;
507 @@ -755,7 +805,7 @@
508 return status;
509 }
510
511 -SANE_Status
512 +DLLEXPORT SANE_Status DLLCALL
513 sane_start (SANE_Handle handle)
514 {
515 Net_Scanner *s = handle;
516 @@ -779,7 +829,7 @@
517 }
518
519 fd = socket (s->hw->addr.sa_family, SOCK_STREAM, 0);
520 - if (fd < 0)
521 + if (!SOCKET_OK(fd))
522 {
523 DBG(1, "start: socket() failed (%s)\n", strerror (errno));
524 return SANE_STATUS_IO_ERROR;
525 @@ -802,7 +852,7 @@
526
527 if (status != SANE_STATUS_GOOD)
528 {
529 - close (fd);
530 + NETCLOSE (fd);
531 return status;
532 }
533 }
534 @@ -813,7 +863,7 @@
535 if (connect (fd, (struct sockaddr *) &sin, len) < 0)
536 {
537 DBG(1, "start: connect() failed (%s)\n", strerror (errno));
538 - close (fd);
539 + NETCLOSE (fd);
540 return SANE_STATUS_IO_ERROR;
541 }
542 shutdown (fd, 1);
543 @@ -823,7 +873,7 @@
544 return status;
545 }
546
547 -SANE_Status
548 +DLLEXPORT SANE_Status DLLCALL
549 sane_read (SANE_Handle handle, SANE_Byte * data, SANE_Int max_length,
550 SANE_Int * length)
551 {
552 @@ -842,7 +892,7 @@
553 {
554 /* boy, is this painful or what? */
555
556 - nread = read (s->data, s->reclen_buf + s->reclen_buf_offset,
557 + nread = NETREAD (s->data, s->reclen_buf + s->reclen_buf_offset,
558 4 - s->reclen_buf_offset);
559 if (nread < 0)
560 {
561 @@ -873,7 +923,7 @@
562 fcntl (s->data, F_SETFL, 0);
563
564 /* read the status byte: */
565 - if (read (s->data, &ch, sizeof (ch)) != 1)
566 + if (NETREAD (s->data, &ch, sizeof (ch)) != 1)
567 ch = SANE_STATUS_IO_ERROR;
568 do_cancel (s);
569 return (SANE_Status) ch;
570 @@ -883,7 +933,7 @@
571 if (max_length > s->bytes_remaining)
572 max_length = s->bytes_remaining;
573
574 - nread = read (s->data, data, max_length);
575 + nread = NETREAD (s->data, data, max_length);
576 if (nread < 0)
577 {
578 if (errno == EAGAIN)
579 @@ -899,7 +949,7 @@
580 return SANE_STATUS_GOOD;
581 }
582
583 -void
584 +DLLEXPORT void DLLCALL
585 sane_cancel (SANE_Handle handle)
586 {
587 Net_Scanner *s = handle;
588 @@ -911,7 +961,7 @@
589 do_cancel (s);
590 }
591
592 -SANE_Status
593 +DLLEXPORT SANE_Status DLLCALL
594 sane_set_io_mode (SANE_Handle handle, SANE_Bool non_blocking)
595 {
596 Net_Scanner *s = handle;
597 @@ -925,7 +975,7 @@
598 return SANE_STATUS_GOOD;
599 }
600
601 -SANE_Status
602 +DLLEXPORT SANE_Status DLLCALL
603 sane_get_select_fd (SANE_Handle handle, SANE_Int *fd)
604 {
605 Net_Scanner *s = handle;
606 diff -ru sane-pre1.01-4/include/sane/config.h.in sane-pre1.01-4-pere/include/sane/config.h.in
607 --- sane-pre1.01-4/include/sane/config.h.in Tue Mar 9 06:50:03 1999
608 +++ sane-pre1.01-4-pere/include/sane/config.h.in Fri Apr 9 01:02:29 1999
609 @@ -335,4 +335,9 @@
610 # define __EXTENSIONS__
611 #endif
612
613 +#ifdef _WINDOWS
614 +# define HAVE_WINDOWS_H
615 +# define HAVE_LOADLIBRARY
616 +#endif
617 +
618 #endif /* SANE_CONFIG_H */
619 diff -ru sane-pre1.01-4/include/sane/sane.h sane-pre1.01-4-pere/include/sane/sane.h
620 --- sane-pre1.01-4/include/sane/sane.h Sun Feb 28 00:54:08 1999
621 +++ sane-pre1.01-4-pere/include/sane/sane.h Fri Apr 9 00:37:53 1999
622 @@ -30,6 +30,14 @@
623 #define SANE_FALSE 0
624 #define SANE_TRUE 1
625
626 +#if defined(_WINDOWS)
627 +# define DLLEXPORT __declspec( dllexport )
628 +# define DLLCALL __cdecl
629 +#else
630 +# define DLLEXPORT
631 +# define DLLCALL
632 +#endif
633 +
634 typedef unsigned char SANE_Byte;
635 typedef int SANE_Word;
636 typedef SANE_Word SANE_Bool;
637 @@ -185,29 +193,29 @@
638 SANE_Char username[SANE_MAX_USERNAME_LEN],
639 SANE_Char password[SANE_MAX_PASSWORD_LEN]);
640
641 -extern SANE_Status sane_init (SANE_Int * version_code,
642 +extern DLLEXPORT SANE_Status DLLCALL sane_init (SANE_Int * version_code,
643 SANE_Auth_Callback authorize);
644 -extern void sane_exit (void);
645 -extern SANE_Status sane_get_devices (const SANE_Device *** device_list,
646 +extern DLLEXPORT void DLLCALL sane_exit (void);
647 +extern DLLEXPORT SANE_Status DLLCALL sane_get_devices (const SANE_Device *** device_list,
648 SANE_Bool local_only);
649 -extern SANE_Status sane_open (SANE_String_Const devicename,
650 +extern DLLEXPORT SANE_Status DLLCALL sane_open (SANE_String_Const devicename,
651 SANE_Handle * handle);
652 -extern void sane_close (SANE_Handle handle);
653 -extern const SANE_Option_Descriptor *
654 - sane_get_option_descriptor (SANE_Handle handle, SANE_Int option);
655 -extern SANE_Status sane_control_option (SANE_Handle handle, SANE_Int option,
656 +extern DLLEXPORT void DLLCALL sane_close (SANE_Handle handle);
657 +extern DLLEXPORT const SANE_Option_Descriptor *
658 + DLLCALL sane_get_option_descriptor (SANE_Handle handle, SANE_Int option);
659 +extern DLLEXPORT SANE_Status DLLCALL sane_control_option (SANE_Handle handle, SANE_Int option,
660 SANE_Action action, void *value,
661 SANE_Int * info);
662 -extern SANE_Status sane_get_parameters (SANE_Handle handle,
663 +extern DLLEXPORT SANE_Status DLLCALL sane_get_parameters (SANE_Handle handle,
664 SANE_Parameters * params);
665 -extern SANE_Status sane_start (SANE_Handle handle);
666 -extern SANE_Status sane_read (SANE_Handle handle, SANE_Byte * data,
667 +extern DLLEXPORT SANE_Status DLLCALL sane_start (SANE_Handle handle);
668 +extern DLLEXPORT SANE_Status DLLCALL sane_read (SANE_Handle handle, SANE_Byte * data,
669 SANE_Int max_length, SANE_Int * length);
670 -extern void sane_cancel (SANE_Handle handle);
671 -extern SANE_Status sane_set_io_mode (SANE_Handle handle,
672 +extern DLLEXPORT void DLLCALL sane_cancel (SANE_Handle handle);
673 +extern DLLEXPORT SANE_Status DLLCALL sane_set_io_mode (SANE_Handle handle,
674 SANE_Bool non_blocking);
675 -extern SANE_Status sane_get_select_fd (SANE_Handle handle,
676 +extern DLLEXPORT SANE_Status DLLCALL sane_get_select_fd (SANE_Handle handle,
677 SANE_Int * fd);
678 -extern SANE_String_Const sane_strstatus (SANE_Status status);
679 +extern DLLEXPORT SANE_String_Const DLLCALL sane_strstatus (SANE_Status status);
680
681 #endif /* sane_h */