Deutsch English Français Italiano |
<vipthe$umjj$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Bart <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: question about linker Date: Wed, 4 Dec 2024 15:46:55 +0000 Organization: A noiseless patient Spider Lines: 75 Message-ID: <vipthe$umjj$2@dont-email.me> References: <vi54e9$3ie0o$1@dont-email.me> <20241129161517.000010b8@yahoo.com> <vicque$15ium$2@dont-email.me> <vid110$16hte$1@dont-email.me> <87mshhsrr0.fsf@nosuchdomain.example.com> <vidd2a$18k9j$1@dont-email.me> <8734j9sj0f.fsf@nosuchdomain.example.com> <vidnp3$1ovvm$2@paganini.bofh.team> <vihpjh$2hgg1$1@dont-email.me> <vihrh1$2hk5l$1@dont-email.me> <vii0jp$2jkd9$1@dont-email.me> <viifv8$2opi7$1@dont-email.me> <vik28b$390eg$1@dont-email.me> <vik8tc$3ang9$1@dont-email.me> <viphuv$37ejl$1@paganini.bofh.team> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 04 Dec 2024 16:46:55 +0100 (CET) Injection-Info: dont-email.me; posting-host="69d0651bc57abb644b06a60528b27c1d"; logging-data="1006195"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+oSAfQ9BRBY9CoTzFmuLOD" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:jwtNiTHI8QW+7d+fwZiVGYtacoI= In-Reply-To: <viphuv$37ejl$1@paganini.bofh.team> Content-Language: en-GB Bytes: 3649 On 04/12/2024 12:29, Waldek Hebisch wrote: > Bart <bc@freeuk.com> wrote: >> You've never used my scheme. > > Your scheme, not. But you should understand that when speaking > about module systems C is an outlier, having almost no support > for modules. Some languages, like C++ and Lisp go half way, > providing namespaces but rest is up to programmer. Other do > more. By now classis is _logical_ separation into interface > and implementation, which seem to be absent from your system. It is there, but at a different boundary. My language is intended for whole program compilation. There are no interfaces between modules (that is, a file listing the exports of a module, separately from the implementation). Because the compiler can see (and will compile) the actual implementation Such interface files exist between programs, which usually means between a main program and the libraries it uses, which are generally dynamically loaded. To that end, when compiling a set of modules into a library, the compiler can generate a suitable interface file (I used to call them exports files). This part is poorly developed, as it is little used, but it can create such files for my two languages, and /could/ generate them for C. There, it would take the form of a header file. Example library, called fred.m: export func add3(int a,b,c)int = a+b+c end Create the DLL and interface: c:\mapps>mm -dll fred Compiling fred.m to fred.dll Writing exports file to fred_lib.m The interface file produced (fred_lib.m): importdllfred = func add3(i64 a,b,c) => i64 end The C version would be: extern i64 add3(i64, i64, i64); Back to my version, I can use that DLL like this: module fred_lib proc main = println add3(10,20,30) end Compile and run that: c:\mapps>mm -r test Compiling test.m to test.(run) 60 As a bonus, this simple example will also run unchanged in my dynamic scripting language; I just need to change the file extensions. So I can trivially create native-code functions to call from dynamic code. But in practice, more work is needed.