1. Eu4.0 alpha std lib errors
- Posted by ChrisB (moderator) Nov 29, 2008
- 1013 views
- Last edited Nov 30, 2008
Hi
A namespace qualifier is needed to resolve 'free' because 'free' is declared as a global/public symbol in: C:\EUPHORIA\include\std\regex.e C:\EUPHORIA\include\std\memory.e
free(text_ptr) ^
Warning ( builtin_chosen ): The built-in find() over rides the global/public find() in: C:\EUPHORIA\ include\std\regex.e
Warning ( builtin_chosen ): The built-in find() over rides the global/public find() in: C:\EUPHORIA\ include\std\regex.e
Error messages from another test
free() seems to be declared twice in the standard lib
find is still present in regex - perhaps it should be removed?
Chris
2. Re: Eu4.0 alpha std lib errors
- Posted by DerekParnell (admin) Nov 29, 2008
- 997 views
- Last edited Nov 30, 2008
A namespace qualifier is needed to resolve 'free' because 'free' is declared as a global/public symbol in: C:\EUPHORIA\include\std\regex.e C:\EUPHORIA\include\std\memory.e free(text_ptr) ^
Yes 'free' is defined twice, and this is deliberate. If you are only using the regex.e library then the 'free' in your code refers to the 'free' in regex.e, and likewise with memory.e. However, when you include both memory.e and regex.e then your code does not know which 'free' to use. Thus you have to tell it.
From the example line of code you gave, it looks like you are wanting to call the 'free' in memory.e. You can do that in a number of ways...
Either ...
include std/memory.e as mem . . . mem:free(text_ptr)
or by using the default namespace ...
include std/memory.e . . . memory:free(text_ptr)
In both cases, we are using an explicit namespace qualifier to let Euhoria know which 'free' we want to use.
Warning ( builtin_chosen ): The built-in find() over rides the global/public find() in: C:\EUPHORIA\ include\std\regex.e
Warning ( builtin_chosen ): The built-in find() over rides the global/public find() in: C:\EUPHORIA\ include\std\regex.e
This is similar the 'free' situation. But in this case we also have 'find' declared as a built-in routine as well as 'find' being declared in a library. When a name clash involves a built-in symbol, we have made the assumption that the built-in symbol is the one actually required unless you tell Euphoria otherwise (by using a namespace qualifier).
The message you see is a Warning only. You can ignore the warning, use a namespace (By the way, the namesace eu is reserved for built-in symbols) such as eu:find( ... ), or disable this warning using the new syntax ...
without warning (builtin_chosen)
3. Re: Eu4.0 alpha std lib errors
- Posted by ChrisB (moderator) Nov 30, 2008
- 962 views
Hi
Thanks - to this and the other post. Hope these are useful for those moving from 3.xx to 4 by the way.
Am working through a lot of programs on my hard drive, and it's surprising (or perhaps it shouldn't be) how common the new reserved words are, for instance free, case, switch, label. Quite few old libs will need to be updated so far, allegro, mixedlib, and Arwen, and win32lib (though I haven't downloaded the most recent). Hopefully just some name changes, but if you have to use 'public include' (among others) in the library, then it will become incompatible with 3.xx.
Obviously no way round this, as I can foresee many great advantages of updating already.
Chris