cosmopolitan/third_party/quickjs
Justine Tunney 5e8c928f1a
Introduce dlopen() support
Every program built using Cosmopolitan is statically-linked. However
there are some cases, e.g. GUIs and video drivers, where linking the
host platform libraries is desirable. So what we do in such cases is
launch a stub executable using the host platform's libc, and longjmp
back into this executable. The stub executable passes back to us the
platform-specific dlopen() implementation, which we shall then wrap.

Here's the list of platforms that are supported so far:

- x86-64 Linux w/ Glibc
- x86-64 Linux w/ Musl Libc
- x86-64 FreeBSD
- x86-64 Windows
- aarch64 Linux w/ Glibc
- aarch64 MacOS

What this means is your Cosmo programs can call foreign functions on
your host operating system. However, it's important to note that any
foreign library you link won't have the ability to call functions in
your Cosmopolitan program. For example it's now technically possible
that Lua can load a module, however that almost certainly won't work
since the Lua module won't have access to Cosmo's Lua API.

Kudos to @jacereda for figuring out how to do this.
2023-11-03 06:37:18 -07:00
..
doc Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
examples Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
tests Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
array.c Unbloat the build 2022-08-11 00:15:29 -07:00
atof.c Remove printf() linking hack 2023-06-17 10:13:50 -07:00
atom.c Unbloat the build 2022-08-11 00:15:29 -07:00
atomics.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
bigdecimal.c Unbloat the build 2022-08-11 00:15:29 -07:00
bigint.c Fix warnings 2023-09-01 20:50:18 -07:00
byte.c Unbloat the build 2022-08-11 00:15:29 -07:00
call.c Make improvements 2023-09-06 12:34:59 -07:00
Changelog Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
cutils.c Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
cutils.h Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
date.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
dbuf.c Unbloat the build 2022-08-11 00:15:29 -07:00
diglet.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
diglet.h Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
eq.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
err.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
float.c Unbloat the build 2022-08-11 00:15:29 -07:00
gc.c Unbloat the build 2022-08-11 00:15:29 -07:00
gen.c Unbloat the build 2022-08-11 00:15:29 -07:00
internal.h Make improvements 2023-09-06 12:34:59 -07:00
iter.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
json.c Unbloat the build 2022-08-11 00:15:29 -07:00
leb128.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
leb128.h Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
libbf.c Add Intel intrinsics headers 2023-04-27 05:44:38 -07:00
libbf.h Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
libregexp-opcode.inc Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
libregexp.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
libregexp.h Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
libunicode-table.inc Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
libunicode.c Unbloat the build 2022-08-11 00:15:29 -07:00
libunicode.h Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
LICENSE Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
list.h Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
map.c Fix warnings 2023-09-01 20:50:18 -07:00
math.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
mem.c Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
object.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
parse.c Unbloat the build 2022-08-11 00:15:29 -07:00
prim.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
promise.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
proxy.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
qjs.c Get us closer to building busybox 2023-06-18 04:13:45 -07:00
qjsc.c Replace COSMO define with _COSMO_SOURCE 2023-08-13 20:55:04 -07:00
qjscalc.js Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
quickjs-atom.inc Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
quickjs-libc.c Introduce dlopen() support 2023-11-03 06:37:18 -07:00
quickjs-libc.h Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
quickjs-opcode.inc Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
quickjs.c Fix warnings 2023-09-01 20:50:18 -07:00
quickjs.h Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
quickjs.mk Introduce dlopen() support 2023-11-03 06:37:18 -07:00
README.cosmo Fix issues revealed by ECMAScript test262 2021-04-10 17:15:35 -07:00
readme.txt Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
reflect.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
regexp.c Unbloat the build 2022-08-11 00:15:29 -07:00
repl.js Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
run-test262.c Make fixes and improvements 2023-07-09 05:21:11 -07:00
shape.c Unbloat the build 2022-08-11 00:15:29 -07:00
str.c Fix warnings 2023-09-01 20:50:18 -07:00
strbuf.c Unbloat the build 2022-08-11 00:15:29 -07:00
test262.conf Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
test262_errors.txt Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
test262o.conf Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
test262o_errors.txt Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
TODO Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
tok.c Unbloat the build 2022-08-11 00:15:29 -07:00
typedarray.c Unbloat the build 2022-08-11 00:15:29 -07:00
unicode_download.sh Revert whitespace fixes to third_party (#501) 2022-07-21 21:46:07 -07:00
unicode_gen.c Increase stack size to 128k and guard size to 16k 2022-12-18 22:58:29 -08:00
unicode_gen_def.inc Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
uri.c Unbloat the build 2022-08-11 00:15:29 -07:00
usage.c Unbloat the build 2022-08-11 00:15:29 -07:00

The main documentation is in doc/quickjs.pdf or doc/quickjs.html.