module main

import dl

#flag -D_GNU_SOURCE

type RealOpen = fn(charptr, int, int) int

@[export: open]
fn open(filename charptr, oflag int, mode int) int {
	real_open := RealOpen((dl.sym(C.RTLD_NEXT, "open")))
	return real_open(filename, oflag, mode)
}