Library problems with gcc
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Dietmar
    Posts: 114 from 2003/2/26
    From: Aachen, Germany
    I want to create a ppc shared library (first attempt) that is called from 68k code but do not get very far. I'm used to SAS/C and Dice. Any help appreciated.

    1. What do do with __aligned in a structure that is shared between 68k and ppc code? Like this:

    Code:

    #pragma pack(2)
    struct foo
    {
    ...
    __aligned struct FileInfoBlock fib;
    ...
    };
    #pragma pack()


    My friend Google says __attribute__((aligned (4))) but that doesn't work, regardless where I put it?

    2. How to get access to global data (ie what is the gcc-replacement for __geta4)?

    3. How to link the library to get strlen(), memset() etc.?

    4. My test skeleton (more or less the same as the skeleton in the devkit) compiles and the test program compiles but if I call the test function, nothing at all happens?! No crash, no action.
    http://projects.dietmar-eilert.net/skeleton.lha
  • »31.10.04 - 14:47
    Profile Visit Website
  • MorphOS Developer
    itix
    Posts: 1520 from 2003/2/24
    From: Finland
    Quote:


    3. How to link the library to get strlen(), memset() etc.?



    You don't. At least not yet. Only solution is that you write memset(), strlen() etc replacements...

    Quote:


    4. My test skeleton (more or less the same as the skeleton in the devkit) compiles and the test program compiles but if I call the test function, nothing at all happens?! No crash, no action.



    Hmm... You don't need gates anymore. You can simplify jumptable:

    static const APTR FuncTable[] =
    {
    (APTR) FUNCARRAY_32BIT_NATIVE,
    (APTR) LIB_Open,
    ....
    (APTR) -1
    };

    This creates jump table accessible from both PPC and 68k code (== AmigaOS 3.x compatible).

    (FUNCARRAY_32BIT_SYSTEMV would create PPC only jump table.)

    Could not find any error from library or test app though... it should work as far as I can see. But when creating inlines with cvinclude.pl you should use -root option too.
    1 + 1 = 3 with very large values of 1
  • »31.10.04 - 17:19
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Dietmar
    Posts: 114 from 2003/2/26
    From: Aachen, Germany
    Quote:

    Hmm... You don't need gates anymore. You can simplify jumptable:


    Interesting. The sdk should be cleaned up. It's extremely confusing to find examples that lack in comments, do not even compile with the SDK and contain undocumented, apparently pointless code.

    Quote:

    Could not find any error from library or test app though


    Thanks for looking into it. I think I've found the problem: the library name. It appears as if the library must have the .library suffix?! It works as generic.library.elf but not as generic.parser.elf (even though in both cases snoopdos reports the library IS opened). Weird. The 68k version of the library works fine as "generic.parser".

    EDIT: the REAL problem was that the editor that was used to write the library opens a library with the same name (oops :)

    [ Edited by Dietmar on 2004/11/2 12:47 ]
  • »01.11.04 - 11:35
    Profile Visit Website