Email or username:

Password:

Forgot your password?
Top-level
witch hat hacker 🎃 types ver

@cwebber

Me: "I don't like safety. So, this means that from my other languages I can dynamically link to C code right?"

C dev: "Of course! As long as you support the C ABI in your other language specifically, for example using the ctypes module in python, or ffi module in racket, or if you painstakingly write your own C wrappers for library calls that integrate the library you want to call with the language runtime for Java and nodejs"

Me: "wait that sounds awful. how is C the 'lingua franca' again?"

C dev: "maybe you should just write the rest of your code in C too /shrug"

11 comments | Expand all CWs
imyxh

@haskal @cwebber I mean yeah, any sort of dynamic linking is going to need some ABI, and supporting that is inevitably going to be some work for someone somewhere. but I think the point stands that dynamic linking still allows for some cross-language compatibility that static linking doesn't really allow at all.

Vertigo #$FF

@imyxh @haskal @cwebber Unless it's built for that purpose. AmigaOS libraries are all statically linked, and they're shared across a wide variety of programs and languages. The OS itself is written as a collection of these libraries (most in C, dos.library in BCPL at one time), which nearly all apps use. Apps take on a variety of languages from BASIC to BCPL to Modula-2 to C to interpreted languages like ARexx.

It's not impossible. Just not done under WIndows or Linux.

Amir Livne Bar-on

@imyxh @haskal @cwebber there's the windows way, that every dynamic library is accompanied by a static library that dlopen()s it and calls it. or at least it used to be this way two decades ago. i'm not sure why they did that but these static libraries can be translated to different languages and implement an ffi internally.

Stroad Warrior

@haskal @cwebber Yeah, it's so annoying that for the C ABI to be the standard, it's necessary for other languages to *actually support the standard *. We should only ever adopt standards that are already supported.

Christine Lemmer-Webber

@cholling @haskal I do think it's annoying that C has become the lingua franca. Rust could provide an alternative, that would be a good initiative on its part. It would still require dynamic linking. Support for the C ABI isn't the primary thing I'm advocating for, it's pointing out that dynamic linking is where C has had the most success.

witch hat hacker 🎃 types ver

@cwebber i don't think i understand your point. currently it's straightforward, using standard tooling, to make a rust dynamic linked shared library and export C headers for it. a lot of mozilla projects are doing this

Christine Lemmer-Webber

@haskal yes, you can do it. but you aren't having conversations with the same people in the Rust community as I have, clearly.

(Notably all the annoying Rust developers are cis dudes, and most of the cool ones are trans girls, who don't typically share this same attitude. Despite the fediverse's reality distortion field, that's not the majority of Rust devs in the wild)

witch hat hacker 🎃 types ver

@cwebber i mean i could write an imagemagick in rust today and export even fully imagemagick-compatible C bindings and have a drop in replacement shared library
i guess i still don't understand the use case you're criticizing here

Christine Lemmer-Webber

@haskal okay I will be very specific about the criticism: it's a criticism of a *cultural* attitude that is anti dynamic linking that I have encountered in Rust. That's not a *tooling* or *technical* criticism. But it is pointing out that this *cultural attitude*, among many but not not all participants (but enough of them), is actually detremental to the goals of being a systems language that upends the problems with C. The counterpoint then is that the Rust community is *encouraged* to *embrace* dynamic linking; this could even be trying to push forward an alternative to the "C ABI" (which doesn't really exist), which I think would be a positive action!

@haskal okay I will be very specific about the criticism: it's a criticism of a *cultural* attitude that is anti dynamic linking that I have encountered in Rust. That's not a *tooling* or *technical* criticism. But it is pointing out that this *cultural attitude*, among many but not not all participants (but enough of them), is actually detremental to the goals of being a systems language that upends the problems with C. The counterpoint then is that the Rust community is *encouraged* to *embrace*...

lonjil

@cwebber @haskal many many Rust libraries have C bindings and no one minds, so I reckon you've had the misfortune of bumping into a shitty minority.

Zumi | nki

@haskal @cwebber I feel like it’s how being the lingua franca like, isn’t it?

Let’s say a you’re a French person who wants to talk to a German person. English being a lingua franca means you are more likely to be able to talk to them in English than forcing them to learn French or vice versa. The problem explodes if you also have a Japanese person in your group, without the lingua franca you’re wasting O(n^2) time learning all the languages to communicate…

Now English being the lingua franca doesn’t mean an Englishman would understand every native language; you’re giving everyone some pain for the forementioned benefit. Even worse it’s not equality, an Australian just has to unlearn some accent words while Japanese people would need to learn a new alphabet, new sentence structure, … But is it worth it? Yea, if you tend to work with other people…

Finally I don’t think that English being the lingua franca means you should be living in the UK (teaching wages suuuuck I’m sorry); being elsewhere has its own benefits, with an obvious downside of having to pick up English…

@haskal @cwebber I feel like it’s how being the lingua franca like, isn’t it?

Let’s say a you’re a French person who wants to talk to a German person. English being a lingua franca means you are more likely to be able to talk to them in English than forcing them to learn French or vice versa. The problem explodes if you also have a Japanese person in your group, without the lingua franca you’re wasting O(n^2) time learning all the languages to communicate…

Go Up