I get undefined references when I try to use oe_strtol. It seems there is no implementation for that function, but there's a prototype in corelibc/stdlib.h (here).
Is this just an oversight or is there a reason for not including this function (and the prototype will be removed too)?
@wintersteiger this appears to just be an oversight. oe_strtoul is supported but oe_strtol is not. I can add it.
Do note the disclaimer in openenclave/coreblibc/stdlib.h
/* DISCLAIMER:
* This header is published with no guarantees of stability and is not part
* of the Open Enclave public API surface. It is only intended to be used
* internally by the OE runtime. */
So I'm happy to add the implementation, but the API is still a bit of "use at your own risk"
Although now that I think about it, strtol is more work to implement than strtoul is. Would strtoul work for your use-case? If so, I'm maybe more inclined to just remove strtol from the header
Well, the reason I got there was that I wanted to use it (I'm also using strtoul). I can work around it, but it likely means that I'll have to implement it in instead of you :-)
I'm not sure about the strategy for corelibc - should I be using 3rdparty/libc/stdlib.h instead?
So basically OE's general stance is that if you want to use a libc implementation, you should use the musl implementation that OE provides in oelibc.
OE implements corelibc as a very minimal libc implementation that can be used by the core libraries and edl generated code (which is why some corelibc headers are published).
An application which does not want to use oelibc has two options:
I'll leave it up to you whether you would rather implement the functionality in OE or in your application.
FYI Issue #2907 tracks the documentation gap around libc vs corelibc. This question is another result of that root problem.
Action item: Remove strtol from corelibc headers.
@wintersteiger Why are you choosing corelibc instead of libC. Are you using it in core code or in application code?
I'm using it in SGX-LKL code, i.e. somewhere in between OE and the actual application. The code around my code used corelibc, so I also tried to use it, but we also need to keep the libc dependencies down to the bare minimum, so I'm hesitant about introducing a new dependency there and I'll likely reimplement what I need.
Most helpful comment
FYI Issue #2907 tracks the documentation gap around libc vs corelibc. This question is another result of that root problem.