![]() |
![]() |
#1 |
Registered User
![]() Join Date: Jun 2018
Location: UK
Posts: 8
|
Using libraries with VBCC (Undefined Symbol)
Hi all
Despite years of (very on and off) programming in C this particular issue is alluding me. I would like to use either ptreplay or medplayer in my little C project, however I get complaints that symbols such as __LoadModule() aren't defined when linking. This is the case with both ptreplay and medplayer. It makes sense that the linker would complain about this, but I'm flummoxed as to the solution. For the avoidance of doubt, I have of course included the proto .h files as required. I have tried passing the .library file to the linker but it complains that it is already a binary file (again, makes sense). I can not find any .lib files for ptreplay or medplayer. Any suggestions? |
![]() |
![]() |
#2 |
ex. demoscener "Bigmama"
![]() Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,437
|
.library files are amiga os libraries, which you need to open using the os openlibrary operation(s).
Some libraries have stubs you can link in, that automatically open/close the amiga library in question and forward the calls to them, but I don't know if the ones you mention have such stubs also. |
![]() |
![]() |
#3 |
Registered User
![]() Join Date: Jun 2018
Location: UK
Posts: 8
|
Thanks hooverphonique.
I understand that .library files are for Amiga OS. When I was trying to use it with the linker I was, admittedly, clutching at straws. OpenLibrary for (for example) medplayer.library appears to work perfectly in my compiled binary. I just can't generate a compiled binary that uses any of the library's own functions because the linker complains that I'm using functions that don't exist. |
![]() |
![]() |
#4 |
Amigan
![]() Join Date: Feb 2012
Location: London
Posts: 1,229
|
The proto include will normally include an 'inline' include that contains inline assembly that loads libbase into a6 and calls the function.
If you're getting references to unknown functions then this is not working. These headers are compiler specific. You cannot use GCC or SASC headers with VBCC. There are tools to generate these headers from the FD files provided by library authors. |
![]() |
![]() |
#5 |
ex. demoscener "Bigmama"
![]() Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,437
|
yes, so in order to invoke e.g. __LoadModule() like any other C function, it would need a stub that forwards that call to the correct library vector, but it sort of sounds like your proto files only declare those stubs, not define them, thus the linker can't locate their implementation.
|
![]() |
![]() |
#6 | |
Registered User
![]() Join Date: Jun 2018
Location: UK
Posts: 8
|
Quote:
THIS is probably the thing I am missing. I have noticed the FD files whilst I was head-scratching but didn't know what they were for. A quick Google indicates that there is a fd2pragma tool included with VBCC. I'll have a play tonight and see what I can do. Thanks very much both of you. Last edited by NoBrain2k; 19 June 2018 at 11:17. Reason: Thanking both |
|
![]() |
![]() |
#7 |
Natteravn
![]() Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,318
|
You need the FD file and the clib prototypes header. Assuming the library is xyz.library, generate the (portable) proto/xyz.h like this:
Code:
fd2pragma special 38 to include/proto xyz.fd Code:
fd2pragma special 70 voidbase to include/inline xyz.fd clib clib/xyz_protos.h |
![]() |
![]() |
#8 | |
Registered User
![]() Join Date: Jun 2018
Location: UK
Posts: 8
|
Quote:
Thanks very much, after a bit of trial and error I finally managed to get this to work. I did actually switch to GCC because I was struggling a bit (and I always wanted to use GCC in linux anyway) but the process was much the same, with different 'special' numbers |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
vasm "undefined symbol" is driving me nuts | jotd | Coders. Asm / Hardware | 6 | 03 December 2017 20:17 |
Reference to undefined symbol __ldivu / __lmodu | iliak | Coders. C/C++ | 8 | 25 July 2016 00:01 |
unresolved symbol __ieeefixdsl (vbcc) | meynaf | Coders. C/C++ | 19 | 19 June 2016 16:32 |
AsmOne: Undefined symbol | copse | Coders. Asm / Hardware | 2 | 02 April 2012 01:41 |
Undefined symbol bsr.b init_bitmaps | VoltureX | Coders. General | 12 | 13 November 2011 16:11 |
|
|