(self, func,
headers=None, include_dirs=None,
libraries=None, library_dirs=None,
decl=False, call=False, call_args=None)
| 313 | return low |
| 314 | |
| 315 | def check_func(self, func, |
| 316 | headers=None, include_dirs=None, |
| 317 | libraries=None, library_dirs=None, |
| 318 | decl=False, call=False, call_args=None): |
| 319 | # clean up distutils's config a bit: add void to main(), and |
| 320 | # return a value. |
| 321 | self._check_compiler() |
| 322 | body = [] |
| 323 | if decl: |
| 324 | if type(decl) == str: |
| 325 | body.append(decl) |
| 326 | else: |
| 327 | body.append("int %s (void);" % func) |
| 328 | # Handle MSVC intrinsics: force MS compiler to make a function call. |
| 329 | # Useful to test for some functions when built with optimization on, to |
| 330 | # avoid build error because the intrinsic and our 'fake' test |
| 331 | # declaration do not match. |
| 332 | body.append("#ifdef _MSC_VER") |
| 333 | body.append("#pragma function(%s)" % func) |
| 334 | body.append("#endif") |
| 335 | body.append("int main (void) {") |
| 336 | if call: |
| 337 | if call_args is None: |
| 338 | call_args = '' |
| 339 | body.append(" %s(%s);" % (func, call_args)) |
| 340 | else: |
| 341 | body.append(" %s;" % func) |
| 342 | body.append(" return 0;") |
| 343 | body.append("}") |
| 344 | body = '\n'.join(body) + "\n" |
| 345 | |
| 346 | return self.try_link(body, headers, include_dirs, |
| 347 | libraries, library_dirs) |
| 348 | |
| 349 | def check_funcs_once(self, funcs, |
| 350 | headers=None, include_dirs=None, |
no test coverage detected