Coding and general discussion relating to the compiler
Moderators: David Barker, Jerry Messina
-
Coccoliso
- Posts: 152
- Joined: Mon Feb 17, 2014 10:34 am
Post
by Coccoliso » Tue Feb 28, 2017 11:00 am
Hi at all,
there is a way to specify a module to be included through OPTION ?
Code: Select all
#option LOGO = "mylogo.jpg"
#if IsOption(LOGO)
Public Const cLOGO_IMAGE_NAME = LOGO
#else
#error "Undefined option LOGO"
#endif
.. this works perfectly and I can refer to the file by replacing his name with cLOGO_IMAGE_NAME .
But
Code: Select all
#option MY_MODULE= "mymodule.bas"
#if IsOption(LOGO)
Public Const cMY_MODULE = MY_MODULE
#else
#error "Undefined option MY_MODULE"
#endif
Include cMY_MODULE
.. does not get the desired result, and the module is not included.
There is a way to do so? Also with some macro?
Thanks to all !
Last edited by
Coccoliso on Tue Feb 28, 2017 11:27 am, edited 1 time in total.
-
Coccoliso
- Posts: 152
- Joined: Mon Feb 17, 2014 10:34 am
Post
by Coccoliso » Tue Feb 28, 2017 11:26 am
Hi,
I found the solution looking Firewing and it's all easier than expected and if it helps someone else :
Code: Select all
#option MY_MODULE = mymodule // (module name without .BAS and spaces)
or
Code: Select all
#option MY_MODULE = "mymodule.bas"
.. and now ..
Code: Select all
#If Not(IsOption(MY_MODULE ))
#error "Undefined option MY_MODULE"
#endif
Include MY_MODULE // Directly refer to an #OPTION
-
octal
- Registered User
- Posts: 586
- Joined: Thu Jan 11, 2007 12:49 pm
- Location: Paris IDF
-
Contact:
Post
by octal » Tue Feb 28, 2017 6:54 pm
Check Jerry's last USB library. If I remember, he use options to include various modules depending on user choices.