Comments (7)
Sorry, no plans.
But for public interest: you should link/provide that example!
from amiga-gcc.
Hello again,
According to official documentation, a .library file is same format as an exe, but just does moveq ΒΈ-1,d0 / rts , then there is a constant sized structure with flags, and then the vector of function pointers in which the 4 firsts are the Open() / Close() / Expunge() functions that are used when doing OpenLibrary() /CloseLibrary() and Expunge() is used when Library is flushed, ... then a null pointer, and then only: the library public exported API as function pointers, corresponding to what a fd file describes.
This is well explained in this short asm example that does compile a valid .library:
https://amigadev.elowar.com/read/ADCD_2.1/Libraries_Manual_guide/node058C.html
I may be wrong, but enclosing static-linked C++ inside an Amiga library with C Api would "just" implies the static inits usually done before entering main() in an exe, would be done in that Open() call, and then closed in the expunge() call. There is something about data allocated for each caller in the documentation, but for a pure "re-entrant" api, which is the case of what I want to port, and most "well done" codes, this is not even needed.
... StormC4 used to patch GCC2.5 but used their own format for makefiles, and I bet they never published their linker sources. there is something called "stormlink" that allows to link a library. in that case the first .o linked is "gcclibrary_startup.o" , which I inspected, and it is exactly looking like the structure described in the link, with names to be replaced... The whole AmigaOS 3.9 must have been compiled with that, This was done by the same team if i'm correct.
I may investigate further myself If there's no plan for generating libraries... I noted that doing gcc -shared would generate a legit "68k elf .so file" ... maybe coding a "dlopen() using 68k elf" on amiga would be a solution.
For information, I have a pistorm here and I've ported a static version of "libheif" , something to read the new .heic image format of the phones. The example "convert-heif" is already 90% working , yet a few of the iOS images I tested have glitchs, but the exe looks stable. it embbeds also libde265, the h265 codec (!). libheif is done in C11 with shared_ptr<> and all, but then the API is very C-looking and would fit a .library and fd file.
My plan is to have a heif.library , and then doing a "datatype class" to allow Amiga Apps to read the images directly, that would use the library. As their is a USB MTP driver with the Amiga Poseidon USB stack, this would allow to read images from modern androids directly.
... If I have a way to generate shared libraries with gcc6, then I would also try to do a python3 port.
from amiga-gcc.
I am building many shared libraries with this gcc and there are no issues with that. As you have found out yourself shared libraries are executables, just built differently. The issue reported here is actually irrelevant to the gcc project itself, so it could be closed here.
You can find examples of my libraries (build with gcc-6.5 and cmake) can be found here:
https://github.com/AmigaPorts/UUID
https://github.com/michalsc/Emu68-tools
from amiga-gcc.
Thanks a lot mister Schulz. I'll just looked at that.
The issue reported here is actually irrelevant to the gcc project itself,
The thing is, newcomers will endlessly try to build shared libraries with the common gcc options. using -nostartfiles and using a init.c to make the executable header is not that intuitive nor documented... Plus, I will look further into your examples, but ideally the .library should also manage the init/close of the C++ runtime.
All thatshould be documented somewhere.
( and also thanks because I am a very happy piStorm user.)
from amiga-gcc.
Yeah, unfortunately AmigaOS shared libraries are completely different from what you know in case of other operating systems, so making a shared .library cannot be done just by adding a -shared
compiler flag. Amiga libraries will always need more work and more boilerplate code.
But you're right, a topic like how to create shared library or .device file in pure C or C++ should be documented somewhere as it would probably help many :)
from amiga-gcc.
Yeah, unfortunately AmigaOS shared libraries are completely different from what you know in case of other operating systems, so making a shared .library cannot be done just by adding a
-shared
compiler flag. Amiga libraries will always need more work and more boilerplate code.But you're right, a topic like how to create shared library or .device file in pure C or C++ should be documented somewhere as it would probably help many :)
Wrong: Now shared libraries can be done just by adding a -shared
compiler flag!
from amiga-gcc.
Read more here: https://franke.ms/amiga/so.wiki
from amiga-gcc.
Related Issues (20)
- Cannot build on MacOS due to CC_FOR_BUILD error HOT 1
- Broken Makefile for 13.1 branch? HOT 1
- Arch Linux "make update" Problem HOT 3
- Program will exit because of unwanted automatic LoadLibrary() with optional lib HOT 2
- aminet links and amitools on Debian and Ubuntu HOT 7
- gcc build fails on Fedora 39 HOT 1
- Unable to compile a Reaction snippet from the NDK3.2 HOT 6
- M3 Mac Book Pro Build - NDK 3.2 Patches Fail HOT 2
- gcc build fails in graphite-isl-ast-to-gimple.c HOT 2
- Question: Optional libraries... possible? HOT 2
- Checked in libamiga.a HOT 1
- @isoriano1968 - "make min" in a pristine repo (and sub project repos) seems to be OK. I'll open another issue for the oddities I noticed. HOT 1
- __divdi3 crashes on 68060 HOT 6
- gcc doesn't build on M1 macOS
- dlfcn.h is installed from clib2 but dl* functions do not exist on AmigaOS 3.x HOT 4
- gcc compile error: `isl_val_free` was not declared in this scope HOT 2
- Duplicate section has different contents HOT 17
- Update VASM (1.9a to 1.9f) HOT 3
- vbcc not building, missing a declaration of some function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amiga-gcc.