xash3d-fwgs/engine/platform/emscripten/lib_em.c
Gleb Mazovetskiy 5e0a0765ce Trim all trailing whitespace
The `.editorconfig` file in this repo is configured to trim all trailing
whitespace regardless of whether the line is modified.

Trims all trailing whitespace in the repository to make the codebase easier
to work with in editors that respect `.editorconfig`.

`git blame` becomes less useful on these lines but it already isn't very useful.

Commands:

```
find . -type f -name '*.h' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
find . -type f -name '*.c' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
```
2021-01-04 20:55:10 +03:00

45 lines
1.3 KiB
C

/*
em_lib.h - dynamic library code for iOS
Copyright (C) 2017-2018 mittorn
This program is free software: you can redistribute it and/sor modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include "common.h"
#include "library.h"
#include "filesystem.h"
#include "server.h"
void *EMSCRIPTEN_LoadLibrary( const char *dllname )
{
void *pHandle = NULL;
#ifdef EMSCRIPTEN_LIB_FS
char path[MAX_SYSPATH];
string prefix;
Q_strcpy(prefix, getenv( "LIBRARY_PREFIX" ) );
Q_snprintf( path, MAX_SYSPATH, "%s%s%s", prefix, dllname, getenv( "LIBRARY_SUFFIX" ) );
pHandle = dlopen( path, RTLD_LAZY );
if( !pHandle )
{
COM_PushLibraryError( va("Loading %s:\n", path ) );
COM_PushLibraryError( dlerror() );
}
return pHandle;
#else
// get handle of preloaded library outside fs
return EM_ASM_INT( return DLFCN.loadedLibNames[Pointer_stringify($0)], (int)dllname );
#endif
}
#endif // __EMSCRIPTEN__