Welcome, Guest. Please login or register.

Author Topic: Sas-C Linker (Stub) Issues...  (Read 6639 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show only replies by EDanaII
    • http://www.EdwardGDanaII.info
Sas-C Linker (Stub) Issues...
« on: November 11, 2011, 07:04:12 PM »
Greets All,

Lately, I've been messing around with something I found on AmiNet, a package called "AFrame" which allows me to approach Amiga coding using OO. It's still kinda primitive and a little old, but I'm think I'm more familiar with it's approach than, say, MUI. Also, I don't think it's quite as robust as MUI, so that's not the point. :)

In any case, I've been reworking through a number of problems trying to get it to recompile on Sas-C, from trying to figure out all the appropriate assigns, locating libraries, such as ReqTools and, presently, getting it to link correctly.

Which is my current problem: when I go to link, SasC comes back and asks for a bunch of "stubs" for ReqTools. For example:

"Enter a DEFINE value for @rtGetLongA__FPUlPcP9rtReqInfoP7TagItem (default ___stub):"

I /think/ this has something to do with my ReqTools lib and ReqTools.h not being for the same version, but, honestly, I don't have a clue at this point. It may also have something to do with when the ReqTools was compiled and the version of the OS (3.1) I'm testing it against. And, then again, it could be aliens...

Anyone got a clue they can spare?

Thanks.
Ed.
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show only replies by EDanaII
    • http://www.EdwardGDanaII.info
Re: Sas-C Linker (Stub) Issues...
« Reply #1 on: November 12, 2011, 04:14:55 AM »
OK, this wasn't meant to be a news item. My bad, can one of the admins move it to the appropriate forum?

Thanks. :)
Ed.
 

Offline Joloo

Re: Sas-C Linker (Stub) Issues...
« Reply #2 on: November 12, 2011, 10:05:28 AM »
I don't have any experience with SAS/C but such constructs like,

@rtGetLongA__FPUlPcP9rtReqInfoP7TagItem

remind me of C++, where the parameter list ist encoded in the function name, to make it unique.

PUl - maybe pointer to unsigned long
Pc - pointer to char
P9 - pointer to rtReqInfo
P7 - pointer to TagItem

thus rtGetLongA__F is the function stub.

It seems that a number following 'P' is the length in bytes for the structure name.


Regards
 

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: Sas-C Linker (Stub) Issues...
« Reply #3 on: November 12, 2011, 02:31:26 PM »
You must be a really bigshot c0der if all your compiler errors are news items :D

I think you forgot to #include ReqTools.h  or somesuch.

You probably included it in one of your source files but not the other source file.  Either that or it is something else :)
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show only replies by EDanaII
    • http://www.EdwardGDanaII.info
Re: Sas-C Linker (Stub) Issues...
« Reply #4 on: November 12, 2011, 03:28:44 PM »
Quote from: ChaosLord;667543
You must be a really bigshot c0der if all your compiler errors are news items :)


Well, shyea! All BOW DOWN before my coding might! ;)

ReqTools.h is being included, so I think this is something else. I think it's a linker issue. I'm assuming it's trying to link to the ReqTools library and that the .h file is a different version than the actually lib file, but I'm not too certain on that.

Adding to my confusion, the version of ReqTools I'm using includes a directory called "Glue" which has a directory with a ReqTools.lib file specific for SasC. But where I'm not sure is whether or not the Linker is linking to the ReqTools.library in the Libs: volume and I should be using the one in the Glue directory. I'm gonna try pointing to that Glue file, but I'm still trying to figure out how...
Ed.
 

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: Sas-C Linker (Stub) Issues...
« Reply #5 on: November 12, 2011, 03:48:48 PM »
Quote
Well, shyea! All BOW DOWN before my coding might! ;)
:laughing:  :roflmao:


I checked my makefile and I found some remnants of some archaic code that no longer exists, which used reqtools.lib!  

There is a very long slink command and at the very end of the line it says lib:reqtools.lib

Sorry I could not be of more help.
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline x303

Re: Sas-C Linker (Stub) Issues...
« Reply #6 on: November 12, 2011, 06:18:51 PM »
You don't need stubs or glue or whatever at all.

You should include these:

#include
#include

struct ReqToolsBase *ReqToolsBase;

and then define these local, not global

  if(ReqToolsBase)
    CloseLibrary((struct Library *)ReqToolsBase);
 

  if((ReqToolsBase = (struct ReqToolsBase *)OpenLibrary (REQTOOLSNAME, REQTOOLSVERSION)) == NULL) CloseAll();

That's all, no linking with anything else.
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show only replies by EDanaII
    • http://www.EdwardGDanaII.info
Re: Sas-C Linker (Stub) Issues...
« Reply #7 on: November 13, 2011, 01:30:09 PM »
All of that is being done, this is previously compiled code that worked. It's just not compiling _for me._ :)
Ed.
 

Offline Joloo

Re: Sas-C Linker (Stub) Issues...
« Reply #8 on: November 13, 2011, 04:45:44 PM »
Quote from: EDanaII;667668
All of that is being done, this is previously compiled code that worked. It's just not compiling _for me._ :)


Still I think it's an issue related to link stage.
"@rtGetLongA__FPUlPcP9rtReqInfoP7TagItem" is a C++ generated function, a plain C compiler would have stored "_rtGetLongA" in the corresponding static lib.
My guess is that if you use some kind of C++ frontend (is this possible for SAS/C?) you'll get such results or you link against a static lib that was compiled by a C++ compiler (MaxonC++/HiSoftC++/StormC) in C++ mode. Because the GNU-C++ compiler doesn't produce Amiga hunk objects natively it cannot be the source of such a lib.
Since SAS/C does produce standard Amiga hunk libs, I assume that you are linking against a C++ generated lib, even if the functions in question are not used at all (I don't think the linker of SAS/C is clever enough to omit unused functions, or, and that's happening too often, the lib in question was created in one flush instead of dividing it into the corresponding parts).
Try to remove the reqtools lib from the makefile, then it should link.
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show only replies by EDanaII
    • http://www.EdwardGDanaII.info
Re: Sas-C Linker (Stub) Issues...
« Reply #9 on: November 13, 2011, 04:59:41 PM »
Nope. That didn't do it, but thanks.

I went into the SCOPTION front end, selected Link options and removed the reference to reqtools.lib and it's still asking me for that value.

You raise an interesting point, though. The project was compiled in SC, but my version of ReqTools (for all I know) wasn't. Maybe if I recompiled it in SC? Need to find the sources...
Ed.
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show only replies by EDanaII
    • http://www.EdwardGDanaII.info
Re: Sas-C Linker (Stub) Issues...
« Reply #10 on: November 13, 2011, 05:19:27 PM »
OK, you may be on to something, Joloo.

Looking closer at ReqTools, in the Glue directory is a section for Sas-C. Digging further, I found the source code, an asm file, for _rtGetLongA.

It also has two files, which I'm assuming are compiled for Sas-C, which I assume I'm linking to, at least I copied them into the libs directory: reqtools.lib and reqtoolsnb.lib.

So, assuming I'm doing everything correctly, why isn't it linking to _rtGetLongA as you suggest?

I'm a newbie when it comes to C++, so forgive me if I'm missing anything obvious...
Ed.
 

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: Sas-C Linker (Stub) Issues...
« Reply #11 on: November 13, 2011, 05:28:36 PM »
Did this project come with a scopts file or a makefile?
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show only replies by EDanaII
    • http://www.EdwardGDanaII.info
Re: Sas-C Linker (Stub) Issues...
« Reply #12 on: November 13, 2011, 05:42:30 PM »
It uses SCOPTIONS to build a .lnk file.
Ed.
 

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: Sas-C Linker (Stub) Issues...
« Reply #13 on: November 14, 2011, 02:27:36 PM »
Have any Holy Water handy?

ur code seems to be posessed. :madashell:
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline Joloo

Re: Sas-C Linker (Stub) Issues...
« Reply #14 on: November 14, 2011, 04:30:43 PM »
Quote from: ChaosLord;667801
Have any Holy Water handy?

ur code seems to be posessed. :madashell:


Na, C++ code is evil per se. ;)


Quote

I'm a newbie when it comes to C++, so forgive me if I'm missing anything obvious...


...and I am really rusty when it comes to C++... :)

But now that I know you are really using C++ your issues look quite clear to me. :)

If you are compiling C++ source codes with SAS/C (didn't know it is possible at all) the thrown error means SAS/C had created the calling convention in style of C++ but since ReqTools is an Amiga shared library the calling convention should have been plain "C" (for the nitpicking ones, I know that this is incorrect, too, but describing the real technique creates more confusion)!

I guess that in the file "clib/reqtools_protos.h" these lines are missing,
in front of the function declarations,
Code: [Select]
#ifdef __cplusplus
extern "C" {
#endif


And right after all function declarations,

Code: [Select]
#ifdef __cplusplus
}
#endif


That's all. Maybe you have to compile those source codes newly which are accessing "clib/reqtools_protos.h", i.e. those which include "proto/reqtools.h". Look for example in "clib/exec_protos.h" how it was done. Hope it helps.

Regards