freenode/#lisp - IRC Chatlog
Search
3:04:33
remexre
with cffi, is there a way to "late-bind" which library name is used? e.g. glfw can load as libglfw or libglfw3, but it appears that it gets "frozen" to whatever name was actually found
3:05:18
remexre
so if my build machine uses libglfw.so.3.1, and my target machine uses libglfw.so.3.2, the binary fails to run
3:18:57
LdBeth
remexre: you may do that by hacking directly with the lower level FFI provided by the implementation
3:20:26
remexre
like if I linked C w/ -lglfw, it'd link to libglfw.so and the symlinks would resolve to .so.3.1 or .so.3.2
3:23:28
LdBeth
Well this is not possible for regular executable binary compiled from languages like C, you know ;0
3:30:24
remexre
er, my point is that there's a slight behavioral difference between gcc -l and cffi; I don't think there's any fundamental difference in capabilities
3:33:00
LdBeth
then you just need to redefine the cffi library to use only libglfw.so for example, and expect the target machine does have the symlink setup
3:34:39
remexre
er, the full filename, I think; I believe it still searches the full LD_LIBRARY_PATH
3:37:47
saturn2
in that case, there may be runtime state created by .so.3.1 that isn't compatible with .so.3.2
3:38:02
LdBeth
ah, right, you have to rerun (cffi:use-foreign-library ) at some time if you save the image
3:38:50
remexre
would I be able to just toss the cffi:use-foreign-library at the top of my :entry-point ?
3:43:27
remexre
https://foundry.remexre.xyz/screenshots/1ec899df9502cae92e08f4ef98f045e66b60c0b6.png
3:46:13
saturn2
you need to close it first https://common-lisp.net/project/cffi/manual/cffi-manual.html#close_002dforeign_002dlibrary
4:18:41
beach
I wonder whether some of the people who insist on using foreign code are converted Pythonista who therefore think that calling C code is the only way to get good performance from their Common Lisp code.
4:27:14
beach
Oh, wait, it's the prisoner's dilemma all over again. If everyone who needs a library that exists only as foreign code instead wrote an equivalent in Common Lisp, then everybody would benefit from everybody's code. But using foreign code is faster for each individual, so, like the prisoners, each individual chooses what benefits him/her. The result is that everybody suffers.
4:29:11
remexre
beach: OpenGL requires interfacing with the hardware directly, in ways not documented by most vendors
4:30:27
beach
I have no answer for you. Personally, I would then do something other than accelerated 3d graphics.
4:31:22
beach
remexre: My observation was not about you. It was about all the suffering I see here in #lisp by people using foreign code.
4:37:03
aeth
beach, remexre: Technically speaking, cl-opengl is mandatory. The rest of the stack (e.g. glfw or sdl), however, is not, but it would require a lot of work to write directly to WinAPI, xlib, etc., for all of the windowing code related to a 3D application.
4:37:26
aeth
(Okay, you could use something like cl-vulkan instead of cl-opengl, but you do need to use a graphics API because it's at the driver level... i.e. it's what the hardware speaks)
4:38:07
remexre
aeth: I mean, I've heard stories whispered in huddled corners of writing directly to the memory-mapped region of the GPU
4:38:51
remexre
so in theory (stretching the bounds of plausibility), you could reimplement all the libGL.so's in CL
4:42:34
aeth
And technically speaking, an implementation could build in OpenGL or Vulkan functionality as well as SDL-like/GLFW-like functionality
4:43:29
remexre
fair, though I feel like there's a difference between implementing GLFW bindings in the implementation and reimplementing a GLFW-like on top of "plain syscalls"
4:44:16
remexre
Sure, but mmap() is a C function in libc, and afaik there's not a nice library for doing "raw syscalls," so in practice you're gonna be calling the C one
4:45:10
beach
remexre: In fact, I started such a project, and it would be great to have an implementation-independent way of making Unix system calls.
4:45:56
remexre
saturn2: as in existing implementations expose something like https://golang.org/pkg/syscall/#Syscall6 ?
4:45:57
saturn2
i've used sbcl's sb-unix::int-syscall and just looked up the syscall number manually
4:46:29
aeth
remexre: In SBCL, you should be able to do raw syscalls without using C because Linux has a stable ABI and SBCL allows you to do "inline asm" (not really "inline" because that's not how Lisp works, but the phrase is from other high level languages).
4:46:56
aeth
For Windows and macOS, the syscalls are an internal interface and you're expected to use the C libraries.
4:47:36
remexre
yeah, it shocked me when a normal windows update actually changed the syscall numbers, breaking an asm program I was writing
4:48:20
aeth
remexre: probably not a normal one... Windows 10 is supposed to be the "last" Windows and they have fairly major updates every 6 months or so, not unlike a distro like Ubuntu or Fedora
4:54:44
remexre
I dunno, if I were MS, I'd change the syscall numbers every update to force people not to depend on them :P
4:55:36
aeth
meanwhile, Linux's tables are, well, simpler, e.g. https://filippo.io/linux-syscall-table/
4:56:36
remexre
idk, I'm kinda trying to go the Oberon route and build my own lang+OS; rn I'm going with s-exprs and image-based, but strongly typed and with hot code loading only at the "thread" level
4:57:27
no-defun-allowed
Just to check, is that statically typed (like Haskell) or strongly typed (like Common Lisp)?
5:03:02
remexre
probably going to have CL-style macros, though I'm not implementing this rn; it looks like most of what I'd want macros for, I could get with some sort of &block (like Ruby blocks)
7:35:22
refusenick
How do I set the axes and labels in wxplot2d and wxplot3d to be white? I'm running Imaxima in Emacs with a dark background, and the default black labels look bad unless I go to a light background.
9:53:15
minion
The URL https://gitlab.common-lisp.net/users/sign_in?secret=c29a8e5b will be valid until 10:00 UTC.
10:49:15
minion
The URL https://gitlab.common-lisp.net/users/sign_in?secret=5363ce94 will be valid until 11:00 UTC.
10:50:56
lxbarbosa
someone @ reddit said that Paul Graham 'needs to learn how to code in Lisp, instead of creating new lisp languages(bel)'
10:55:43
minion
The URL https://gitlab.common-lisp.net/users/sign_in?secret=5363ce94 will be valid until 11:00 UTC.