what different from PORT BUILTIN

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
User avatar
fkeujjpdc
Posts: 13
Joined: Thu Mar 23, 2017 3:17 am
Location: china

what different from PORT BUILTIN

Post by fkeujjpdc » Tue Mar 28, 2017 3:14 am

Code: Select all

MICROPY_PORT_BUILTIN_MODULES   MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS   MICROPY_PORT_CONSTANTS
these three marco is seems same,why split three marco ,What are the details they different。
if i want export a class or function,which marco is better for me.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: what different from PORT BUILTIN

Post by dhylands » Tue Mar 28, 2017 3:53 am

MICROPY_PORT_BUILTIN_MODULES is used to define builtin modules. modules included in this will be located when you do import module_name.

MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS is used to define weak links. In the stmhal port, for example weak links ubinascii to binascii. This allows 2 things. 1 - You can use import binascii and if there is no binascii module otherwise then it will import ubinascii instead. 2 - The u modules are micro-modules and don't include the full functionality of a module. Often times, the missing functionality can be implemented in python. By using weak links, it allows a python module names binascii to be implemented, this overriding the weak-link.

MICROPY_PORT_CONSTANTS defines constants that the parser will substitute with the real object.

So all 3 serve very distinct purposes.

User avatar
fkeujjpdc
Posts: 13
Joined: Thu Mar 23, 2017 3:17 am
Location: china

Re: what different from PORT BUILTIN

Post by fkeujjpdc » Tue Mar 28, 2017 2:53 pm

thanks for your patience ,i got it

Post Reply