[comp.sys.amiga.tech] Shared library creation question

bmacintyre@watcgl.waterloo.edu (Blair MacIntyre) (05/15/89)

I'm in the process of trying to create a shared disk library.  The
problem is simple, actually:  it doesn't work! :-)

My question is this:  what shouldn't I be doing from a shared library
that I can do from a program that would be calling it?

If I link the library object directly with the test programs, they
work fine.  When I try using the shared lib, things start dying.
I'm getting seemingly random errors ... invalid address, F line
type opcode ( invalid opcode ), invalid instructions ... I can't
really figure it out.  

I followed it through the interface and it is ending up inside the 
code, but it is dying somewhere inside ...

I am using Manx FFP for the math inside the lib.  It seems to 
work.  I am passing in GfxBase, but that isn't relavent (yet! :-) since
it isn't in a routine that used any graphics routines.

To construct the lib I converted one of my source files to a format
usable my mklib and then took the output as a sample and did the
rest of the interface.asm and link.asm routines by hand.  

Anybody have any pointers about where I can start looking?  

Blair
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-///-=
= Blair MacIntyre, bmacintyre@watcgl.{waterloo.edu, UWaterloo.ca}     \\\///  =
=   now appearing at the Computer Graphics Lab, U of Waterloo!         \XX/   =
= "Don't be mean ... remember, no matter where you go, there you are." BBanzai=

thomas@cbmvax.UUCP (Dave Thomas QA) (05/16/89)

In article <9698@watcgl.waterloo.edu> bmacintyre@watcgl.waterloo.edu (Blair MacIntyre) writes:
> I'm in the process of trying to create a shared disk library.  The
> problem is simple, actually:  it doesn't work! :-)
> 
> My question is this:  what shouldn't I be doing from a shared library
> that I can do from a program that would be calling it?

You should probably avoid making most compiler library calls (unless you
have source and can check to see what they are doing).  They often use
global variables which will cause problems if multiple tasks use the
library.
 
> If I link the library object directly with the test programs, they
> work fine.  When I try using the shared lib, things start dying.
> I'm getting seemingly random errors ... invalid address, F line
> type opcode ( invalid opcode ), invalid instructions ... I can't
> really figure it out.  
> 
> I followed it through the interface and it is ending up inside the 
> code, but it is dying somewhere inside ...
> 
> I am using Manx FFP for the math inside the lib.  It seems to 
> work.  I am passing in GfxBase, but that isn't relavent (yet! :-) since
> it isn't in a routine that used any graphics routines.
> 
> To construct the lib I converted one of my source files to a format
> usable my mklib and then took the output as a sample and did the
> rest of the interface.asm and link.asm routines by hand.  
> 
> Anybody have any pointers about where I can start looking?  

"Pointers" is exactly right :-)
I haven't done Manx in a while, but I think that you are having 
addressability problems.  If you use any global variables or use any
compiler provided link library routines, you may need to put a call
to geta4() in the front of your routines.  You should also disable
any stack checking code.

I've done a library in Lattice 5.02, but haven't tried it with Manx. It
ought to work if your careful...
 
> Blair

Dave
-- 
Dave Thomas, Commodore Amiga Test Engineering
UUCP  ...{allegra,rutgers}!cbmvax!thomas

bmacintyre@watcgl.waterloo.edu (Blair MacIntyre) (05/17/89)

In article <6883@cbmvax.UUCP> thomas@cbmvax.UUCP (Dave Thomas QA) writes:
>You should probably avoid making most compiler library calls (unless you
>have source and can check to see what they are doing).  They often use
>global variables which will cause problems if multiple tasks use the
>library.


Ok, I'll look at that ... I'm using a few Manx lib calls.  Can't 
remember which, though, of hand.

  
>> Anybody have any pointers about where I can start looking?  
>
>"Pointers" is exactly right :-)
>I haven't done Manx in a while, but I think that you are having 
>addressability problems.  If you use any global variables or use any
>compiler provided link library routines, you may need to put a call
>to geta4() in the front of your routines.  You should also disable
>any stack checking code.

I'm using Edwin Hoogerbeets MKLIB as a basis and it provides it's own
geta4() and uses it each time.  It also has it's own .begin label
and one other label that overrides one in c.lib ( I can't remember
which one )

I will check this out.  I hope no important routines are unusable ...
that would be such a pain!
:-)


Thanks,

	Blair
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-///-=
= Blair MacIntyre, bmacintyre@watcgl.{waterloo.edu, UWaterloo.ca}     \\\///  =
=   now appearing at the Computer Graphics Lab, U of Waterloo!         \XX/   =
= "Don't be mean ... remember, no matter where you go, there you are." BBanzai=