Wrapped the init example in a main() for maximum clarity.

This commit is contained in:
Pietro Gagliardi 2019-04-20 21:56:50 -04:00
parent 484989e925
commit 2652772891
1 changed files with 10 additions and 6 deletions

View File

@ -15,6 +15,8 @@ Furthermore, on some systems, this thread must also be the thread that `main()`
Here is an example of correct use of `uiInit()` in C: Here is an example of correct use of `uiInit()` in C:
```c ```c
int main(void)
{
uiInitError err; uiInitError err;
memset(&err, 0, sizeof (uiInitError)); memset(&err, 0, sizeof (uiInitError));
@ -23,6 +25,8 @@ if (!uiInit(NULL, &err)) {
fprintf(stderr, "error initializing libui: %s\n", err.Message); fprintf(stderr, "error initializing libui: %s\n", err.Message);
return 1; return 1;
} }
// ...
}
``` ```
Note that if `uiInit()` fails, you **cannot** use libui's message box functions to report the error. Note that if `uiInit()` fails, you **cannot** use libui's message box functions to report the error.