Added to/from str to NID and extern C to wrap