08 September 2009, 01:48 | #1 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,408
|
Trying to use a shared library in StromC V4 (default gcc compiler)
Hiya,
I thought this would be easy but of course it's not I'm trying to use someone else's sound library in my C++ project, I don't know much about this library but I do have the original source code (SAS/C) that used it plus (I think) the assembler source code of the library itself I was hoping it would be as easy as adding the library to my project's list of libraries in Storm C and then adding the library's header file but this just results in Storm C giving me a linker error saying that the library is already linked The original code used the following method of loading the library Code:
DoomSndBase = OpenLibrary ("doomsound.library",37) Code:
extern void Sfx_SetVol (int vol); #pragma libcall DoomSndBase Sfx_SetVol 1e 001 Now I've read that this weird Pragma calls are compiler specific...is this the cause of my angst? If so, how do determine the correct ones for the version of GCC that I'm using? Last edited by NovaCoder; 09 September 2009 at 01:37. |
08 September 2009, 04:38 | #2 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,408
|
After looking at a StormC shared library example it looks like you need to include an assembler file representation of the library you are trying to link to. This seems more than a little odd to me, why do you need to do this?
In the example they refer to it as an assembler 'stub' but to me it looks like it contains the actual implementation, is that correct? stubs.asm Code:
XREF _TestBase XDEF _AddTwo XDEF _AddThree _AddTwo move.l 4(sp),d0 move.l 8(sp),d1 move.l a6,-(sp) move.l _TestBase,a6 jsr -30(a6) move.l (sp)+,a6 rts _AddThree movem.l a6/d2,-(sp) move.l 12(sp),d0 move.l 16(sp),d1 move.l 20(sp),d2 move.l _TestBase,a6 jsr -36(a6) movem.l (sp)+,a6/d2 rts Code:
#pragma libbase LibBase int AddTwo(__REGD0(int a), __REGD1(int b), __REGA6(struct LibBase *base)) { return base->last_result = a + b; } int AddThree(__REGD0(int a), __REGD1(int b), __REGD2(int c), __REGA6(struct LibBase *base)) { return base->last_result = a + b + c; } Last edited by NovaCoder; 08 September 2009 at 07:41. |
08 September 2009, 11:46 | #3 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,408
|
Well it appears that this is just an ASM Stub so the question is how to I generate a STUB for the library that I want to link to in my STORM project?
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
GCC and ixemul.library | Rixa | Coders. Language | 24 | 10 November 2016 23:18 |
Pascal compiler | bx20 | support.Apps | 10 | 20 August 2010 13:45 |
C compiler | raptor_13 | Coders. General | 14 | 27 May 2008 09:40 |
latest GCC compiler 68k | Tony Landais | Coders. General | 27 | 23 November 2006 01:02 |
Making a shared library from a gcc .a library | JoJo | Coders. General | 1 | 10 March 2003 19:06 |
|
|