@c.cacheproperty
    def dlopen(self):
        if not self.header:
            return

        lib_code = '''
            #ifdef __cplusplus
            extern "C" {
            #endif
            #if defined _WIN32 || defined __CYGWIN__
            __declspec(dllexport)
            #elif defined __GNUC__
            __attribute__ ((visibility ("default")))
            #endif
            int fred(int argc, char** argv) { return 0; }
            #ifdef __cplusplus
            }
            #endif
        '''

        exe_code = '''
            #include <dlfcn.h>
            #include <stdlib.h>

            int main(int argc, char** argv) {
                void* lib = dlopen("%s", RTLD_NOW);
                void* fred = 0;
                if(!lib) return 1;
                fred = dlsym(lib,"fred");
                if(!fred) return 1;
                return dlclose(lib) == 0 ? 0 : 1;
            }
        '''

        self.ctx.logger.check("checking dlopen in 'dlfcn.h'")

        with fbuild.temp.tempfile(lib_code, self.builder.src_suffix) as lib_src:
            try:
                obj = self.shared.uncached_compile(lib_src, quieter=1)
                lib = self.shared.uncached_link_lib(
                    'temp' / lib_src.parent, [obj],
                    quieter=1)
            except fbuild.ExecutionError:
                pass
            else:
                if self.builder.try_run(exe_code % lib,
                        lkwargs={
                            'flags': self.flags,
                            'libpaths': self.libpaths,
                            'libs': self.libs,
                            'external_libs': self.external_libs},
                        quieter=1):
                    self.ctx.logger.passed()
                    return c.Function('void*', 'const char*', 'int')

            self.ctx.logger.failed()
            return None
dataset/ETHPy150Open felix-lang/fbuild/lib/fbuild/config/c/posix04.py/dlfcn_h.dlopen/swapped operands of `/`