static int demo_init(void) //模块初始化函数 cdev_init(&chr_dev,&chr_ops);//初始化字符设备对象。chr_ops定义在上面 .
基于2个网页-相关网页
Python在模块装入时调用初始化函数。
Python calls the initialization function when the module loads.
my_module_init 函数是在加载这个模块时被调用的,它用来进行一些初始化方面的工作。
The my_module_init function is called when the module is loaded and the function can be used for initialization purposes.
初始化函数将完成模块所要求的所有初始化操作,但更重要的是,它还把一个指向方法表的指针传回给Python。
It does whatever initialization is required for the module, if any, but most crucially, it also passes a pointer to the method table back to Python.
应用推荐