shared lib

shared lib

Post by bric » Tue, 27 Jun 2006 18:05:32


Hello all, i would like to know is it possible to use shared libs (like
dll or so) in OS-9/68K V3.2.0

because I done a multiprocess way target and i just have 4Mo flash and
my librairy (.lib) is about 700k





excuse me for my english because i'm french

thank you
 
 
 

shared lib

Post by Martin Gre » Tue, 27 Jun 2006 23:44:54


Yes. Most system libraries work this way.

Its not all that easy. The library is a separately loadable module. You
link to a stub library that contains function stubs. This uses software
interrupts to access functions in the preloaded module. Its usual to use
assembler "glue" to build the linkage code.

It's all described in the system manual, though those are quite terse.
Longer descriptions can be found in "OS9 Insights" (Peter Dibble) or
"The OS9 Guru" (Paul Dayan) - both now very hard to find.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |

 
 
 

shared lib

Post by OS-9 A » Wed, 28 Jun 2006 01:48:47

rice wrote:

Was this "Enhanced OS-9 for 68K 1.2?" If so, 1.3 (3.3.x I think) was
released a few months ago. You might want to see if you qualify for the
update.

As to subroutine modules, there are trap libraries (which can run in
system state or user state, via a kernel system call -- similar to how
OS-9 OS calls are made) and then subroutine libraries (which run in the
state of the caller) which are more direct calls (no OS call involved).
Traps have their own static storage (ie, they can declare "int i" and
it always exists) and subroutines are just function points (no
globals). Here's a simple subroutine for 68K:

sublib.c:

/*--------------------------------------------------------------------------|
| SUB_68K/sublib.c: |
| Sample OS-9/68K style soubroutine library written in 'C'. |
| Subroutine libraries may: |
| 1) accept multiple parameters |
| 2) change any pass-by parameters |
| 3) return values |
| And they may not: |
| 1) access any of the calling program's global variables by name |
|---------------------------------------------------------------------------|
| Edition History
|
|
|
| Ed. Date What happened
who |
| -- -------- --------------------------------------------------- --- |
| 01 / / Created, hacked etc... |
| 02 96/07/02 Made example similar to trap sample
ach |
| 03 00/04/05 Updated for Hawk.
ach |
|--------------------------------------------------------------------------*/

#include <types.h>
#include <modes.h>

/*------------------------------------|
| Subroutine library routines follow. | --------------------------
Modify Here
|------------------------------------*/

/*---------------------------------|
| function1 - does nothing useful. |
|---------------------------------*/
u_int32 function1()
{
#ifdef USER_STATE_68K
u_int32 count;

count = 80;
_os_writeln( 1, "Inside subroutine function 1.\n", &count );
#endif

return 42;
}

/*--------------------------------------|
| function2 - also does nothing useful. |
|--------------------------------------*/
u_int32 function2()
{
#ifdef USER_STATE_68K
u_int32 count;

count = 80;
_os_writeln( 1, "Inside subroutine function 2.\n", &count );
#endif

return 43;
}


subtest.c:
#define SUB_MOD_NAME "sublib"

/*--------------------------------------------------------------------------|
| SUB_68K/subtest.c:
|
| This T&E example program links to a subroutine module and
calls |
| functions within the subroutine module. |
|---------------------------------------------------------------------------|
| Edition History
|
|
|
| Ed. Date What happened
who |
| -- -------- --------------------------------------------------- --- |
| 01 91/01/24 Created mja |
| 02 94/06/23 Updated for Ultra-C mah |
| 03 96/03/26 Make OS-9/OS-9000 Friendly mah |
| 04 96/07/02 Made code similar to trap/OS9K examples ach |
|--------------------------------------------------------------------------*/

#include <stdio.h>
#include <stdlib.h>

#include <types.h>
#include <module.h>

#ifdef _OS9000
/* structure element conversion OS-9/68k --> OS-9000 */
#define _mexec m_exec
#endif

mh_com *modptr; /* made global so we can link/unlink from diff.
functions */

/*------------------
 
 
 

shared lib

Post by P Colye » Mon, 08 Jan 2007 05:37:23

notice a reference to the book "OS9 Insights" by Petter Dibble on this
thread -
a search on the web pulled up this site

http://rab.ict.pwr.wroc.pl/dydaktyka/supwa/os9/MWARE/os9insights/Books/

could be useful ?




"OS-9 Al" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
/*--------------------------------------------------------------------------
|
|---------------------------------------------------------------------------
|
|--------------------------------------------------------------------------*
/
/*--------------------------------------------------------------------------
|
|---------------------------------------------------------------------------
|
|--------------------------------------------------------------------------*
/
****************************************************************************
**


 
 
 

shared lib

Post by Martin Gre » Mon, 08 Jan 2007 09:09:04


Its a good book, but beware that it was written round OS-9 v2.4 and then
, AFAIK, revised for V3.0, so it assumes that you're running on Motorola
68xxx hardware and that the low level trap handling will be written in
assembler.

Peter Dibble worked for Microware when he wrote it: you can safely
assume that he knew what he was talking about.



--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |