18 August 2017, 06:21 | #1 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Linking with -lmieee in a shared library
I'm porting a matrix math library I wrote to Amiga for something I'm working on. I want to install it as a shared library. I'm writing it in C and using it from a program written in ASM. I'm using VBCC and the CLib37 example code from Aminet.
I know I need to link it with -lmieee to use the Amiga native floating point libraries but since compiling as a shared library doesn't bring in the C runtime, I've got a problem where compiling it ends up with undefined reference errors. Code:
vc -nostdlib -lamiga -lmieee -cpu=68020 -fpu=68882 -o matrix.library obj/StartUp.o obj/LibInit.o obj/SampleFuncs.o obj/matrix.o \amiga-dev\targets\m68k-amigaos\lib\mieee.lib(math/math_ieee/_mieee.c): In "__INIT_1_mieee": Error 21: \amiga-dev\targets\m68k-amigaos\lib\mieee.lib(math/math_ieee/_mieee.c) (CODE+0x7a): Reference to undefined symbol _exit. Error 21: \amiga-dev\targets\m68k-amigaos\lib\mieee.lib(math/math_ieee/_mieee.c) (CODE+0x9e): Reference to undefined symbol _exit. Error 21: \amiga-dev\targets\m68k-amigaos\lib\mieee.lib(math/math_ieee/_mieee.c) (CODE+0xc2): Reference to undefined symbol _exit. |
18 August 2017, 07:20 | #2 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Nevermind, I just added an _exit() that gurus if the fp library crashes and it's happy now.
|
18 August 2017, 07:59 | #3 | |
Banned
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
|
Please remove the "-fpu=68882" when "-lmieee" is specified.
Quote:
|
|
18 August 2017, 08:35 | #4 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Yeah, I saw that too. I changed out the flags and got it compiling and running with my program
The function names don't appear in Scout but oh well. |
18 August 2017, 13:24 | #5 | |
Banned
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
|
Quote:
As I recall, this requires a .fd file for matrix.library and a FD: assign to the location of the .fd files. |
|
18 August 2017, 23:41 | #6 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
If I fix a bug in the library, is there a way to kick the old version out of memory completely other than rebooting?
|
18 August 2017, 23:55 | #7 |
Registered User
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,153
|
It's been a while, so I'm not sure about this - but doesn't "avail flush" do just that, provided no applications currently have the library open?
|
19 August 2017, 00:44 | #8 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Of course, when the application crashes it doesn't free the library. Scout can forcefully free it and then I can flush the cache through WB.
|
19 August 2017, 04:39 | #9 |
Registered User
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,366
|
Not sure what you really want to do, but you could call Forbid(), change lib_Node/ln_Name from "matrix.library" into something else like "old_matrix.library", then CacheClearU(), Permit() and load your new patched matrix.library. Of course, this is just some sort of bad coding.
|
19 August 2017, 06:09 | #10 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Here's a question for you. I'm trying to calculate a rotation matrix but I think the compiler is screwing up my floating point format. I'm using the latest vbcc, optimization disabled.
Code:
VOID GetXRotationMatrixForOrientation( register __a0 Orientation *o, register __a1 Matrix44 *destination ) { FLOAT rad = degreesToRadians(o->rotation.x); IdentityMatrix44(destination); destination->data[1][1] = IEEESPCos(rad); destination->data[1][2] = IEEESPSin(rad); destination->data[2][1] = -IEEESPSin(rad); destination->data[2][2] = IEEESPCos(rad); } Code:
_GetXRotationMatrixForOrientation sub.w #16,a7 movem.l l42,-(a7) move.l a0,a3 move.l a1,a2 move.l (12,a3),d0 jsr _degreesToRadians move.l d0,d1 move.l d1,d2 move.l a2,a0 jsr _IdentityMatrix44 move.l d2,-(a7) jsr __ieees2d ;<-- ? movem.l d0/d1,-(a7) jsr _IEEESPCos edit: A new vbcc was just released this week actually! I upgraded to it and now the generated calls are all given single-precision operands. The numbers I'm getting back at least make sense now! Still need to do some debugging to figure out why they're not right though. Last edited by LuigiThirty; 19 August 2017 at 09:22. |
21 August 2017, 22:30 | #11 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Hey, I got it working! Other than an FOV issue (it's extremely fisheye) and no clipping so if a line goes out of the screen coordinates it trashes chipmem.
https://twitter.com/LuigiThirty/stat...28868772380673 |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Shared configuration | Anubis | support.FS-UAE | 2 | 25 April 2016 23:51 |
Closing a window with shared Messageport? | AGS | Coders. System | 0 | 18 March 2015 15:05 |
HELP: Opus5, KingCON, SysInfo.library (Sysmon.library) triangle | Michael | support.Apps | 6 | 10 March 2014 14:08 |
How do i Get Miami to mount shared folders | Rogueraven | support.Hardware | 6 | 13 March 2008 11:57 |
Making a shared library from a gcc .a library | JoJo | Coders. General | 1 | 10 March 2003 19:06 |
|
|