2
** Copyright (C) 2006 Erik de Castro Lopo <erikd@mega-nerd.com>
4
** This program is free software; you can redistribute it and/or modify
5
** it under the terms of the GNU General Public License as published by
6
** the Free Software Foundation; either version 2 of the License, or
7
** (at your option) any later version.
9
** This program is distributed in the hope that it will be useful,
10
** but WITHOUT ANY WARRANTY; without even the implied warranty of
11
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
** GNU General Public License for more details.
14
** You should have received a copy of the GNU General Public License
15
** along with this program; if not, write to the Free Software
16
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29
#if (HAVE_DECL_S_IRGRP == 0)
30
#include <sf_unistd.h>
36
#include <sys/types.h>
40
#if (defined (WIN32) || defined (_WIN32) || defined (__CYGWIN__))
50
#define DLL_NAME "cygsndfile"
52
#define DLL_NAME "libsndfile"
55
static const char * locations [] =
56
{ "../src/", "src/", "../src/.libs/", "src/.libs/",
61
test_ordinal (HMODULE hmod, const char * func_name, int ordinal)
65
print_test_name ("win32_ordinal_test", func_name) ;
67
ord = GetProcAddress (hmod, (LPSTR) ordinal) ;
68
if ((name = GetProcAddress (hmod, func_name)) == NULL)
69
{ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError (),
70
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpmsg, 0, NULL) ;
74
if (name != NULL && ord != NULL && name == ord)
84
win32_ordinal_test (void)
85
{ static char buffer [1024] ;
86
static char func_name [1024] ;
89
int k, ordinal, errors = 0 ;
91
for (k = 0 ; locations [k] != NULL ; k++)
92
{ snprintf (buffer, sizeof (buffer), "%s/%s.def", locations [k], DLL_NAME) ;
93
if ((file = fopen (buffer, "r")) != NULL)
98
{ puts ("\n\nError : cannot open DEF file.\n") ;
102
for (k = 0 ; locations [k] != NULL ; k++)
103
{ snprintf (buffer, sizeof (buffer), "%s/%s-1.dll", locations [k], DLL_NAME) ;
104
if ((hmod = (HMODULE) LoadLibrary (buffer)) != NULL)
109
{ puts ("\n\nError : cannot load DLL.\n") ;
113
while (fgets (buffer, sizeof (buffer), file) != NULL)
114
{ func_name [0] = 0 ;
117
if (sscanf (buffer, "%s @%d", func_name, &ordinal) != 2)
120
errors += test_ordinal (hmod, func_name, ordinal) ;
128
{ printf ("\n\nErrors : %d\n\n", errors) ;
133
} /* win32_ordinal_test */
141
win32_ordinal_test () ;
149
** Do not edit or modify anything in this comment block.
150
** The arch-tag line is a file identity tag for the GNU Arch
151
** revision control system.
153
** arch-tag: 708f6815-e787-4143-bb99-f32c1bb5564e