English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 10 September 2019, 19:21   #1
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 182
[Blitz] Accessing external library

Hi,
is it possible to use external library in Blitz?
Let's say I'd like to open prisma.library and have some fun with it

so far:
Code:
*prisma.Library = OpenLibrary_("prisma.library",0)
If *prisma
  ;-----------------
  ;what should I write here?
  ;------------------

  CloseLibrary_(*prisma)
EndIf
End
Thanks
peceha is offline  
Old 10 September 2019, 22:40   #2
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,204
If you have the .fd file for the library, there's a tool included with Blitz that can make a wrapper Blitz command library containing all the prisma library's functions in it. That's how I've done it in the past, though using the library directly would be nicer...
Daedalus is offline  
Old 10 September 2019, 23:26   #3
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 182
Thanks Daedalus.
In the meantime I found one post (very old) in Prisma Megamix thread about what you just said:

Quote:
Quote:
Originally Posted by amigakit.com View Post
Also Prisma has a nice Arexx interface so programs can control Prisma easily. If you are using Backbone, Blitz or anything that supports Arexx, it can be useful.
Nice, but for Blitz we can happily accept the LVO/FD file and therefore you deliver support for Blitz and AmiBlitz natively!
Unfortunately I don't have such file.
Does it mean .. there is no other way?

Thanks.
peceha is offline  
Old 10 September 2019, 23:42   #4
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,204
Well, you need some way to read the function table within the library to determine what's contained in it. Usually if a library is meant for external use there will be various support files including the .fd file and some header files that allow a C compiler to use them. Alternatively you can jump directly to the offsets in the jump table, but even then you need to know the offset values. If you don't have any of that stuff, well then there isn't really a way, no.

Those files would usually be included with the library, or sometimes as a separate developers package. I take it they didn't offer the information in that thread? Seems a shame to keep such information to themselves.
Daedalus is offline  
Old 10 September 2019, 23:48   #5
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 182
I will check what's on floppy that was included with Prisma sound card - but I do not recall seeing anything special there.

And will go through that whole thread, but this is going to be boring task since that thread is soooo long.
peceha is offline  
Old 11 September 2019, 07:42   #6
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 182
There is nothing on the floppy.

While checking the thread about prisma all I found is:
Quote:
Here's what you currently need to do to play an OGG Vorbis file:
Code:
PrismaBase = OpenLibrary( "prisma.library", 0L);
Prisma_Init();
Prisma_PlayFile( "GreatMusic.ogg" );
CloseLibrary( PrismaBase);
..which isn't very helpful, is it?
peceha is offline  
Old 11 September 2019, 09:49   #7
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,204
Indeed it's not. You still need the header/stub files etc. for that code to work, otherwise the compiler doesn't know how to access those functions.

Incidentally, I was looking for a Prisma card a while ago to do my own development with, but they can't seem to be found any more I was also thinking of writing a Blitz wrapper for it for my own player, as well as potentially developing add-on hardware...
Daedalus is offline  
Old 11 September 2019, 13:38   #8
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 182
So... prisma.library cannot be used but what about mhiprisma.library?
There is a mhi_dev archive on aminet and it includes blitz2 add-on.
Will try that today.
peceha is offline  
Old 11 September 2019, 14:45   #9
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,204
Yep, that should work just fine, though I suspect it will limit the formats supported to MP2/3 as MHI appears to be MPEG-specific.
Daedalus is offline  
Old 12 September 2019, 08:05   #10
E-Penguin
Banana

 
Join Date: Jul 2016
Location: Darmstadt
Posts: 850
I guess you could run the library through a disassembler, add the blitz2 function headers then recompile it as a blitz2 library, similar to what was done for the PTPlayer library.
E-Penguin is offline  
Old 12 September 2019, 09:45   #11
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,883
No, that's very pointless and against the point of shared libraries. Just ask for the FD file.
idrougge is offline  
Old 13 September 2019, 19:46   #12
E-Penguin
Banana

 
Join Date: Jul 2016
Location: Darmstadt
Posts: 850
It's not pointless in the slightest given that nobody seems to have an fd file
E-Penguin is offline  
Old 13 September 2019, 20:36   #13
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,883
Have you tried even asking for the SDK? If it doesn't have FD or header files, it can't be used from any language.
idrougge is offline  
Old 13 September 2019, 21:19   #14
E-Penguin
Banana

 
Join Date: Jul 2016
Location: Darmstadt
Posts: 850
Documentation seems to be bare, to put it mildly. There's allegedly an Arexx port but no documentation for that either.

Disassembling seems to have worked well enough but without an API to go by I can't work out which JMP corresponds to which function.
E-Penguin is offline  
Old 27 September 2019, 22:56   #15
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 182
I've been trying to use id3tag.library (FD file included) with BB2.
I used FD file converter (from AmiBlitz3) and I got a file: id3tag.library1
I moved that library to BLITZLIBS:amigalibs and ran MakeDefLibs to update DefLibs file.
So far so good - after starting BB2 I can see that commands from new library are being recognized (tokenized).

Unfortunately I am not able to initiate ID3Tag structure
DEFTYPE.ID3Tag *id3
gives me "type not found" error (I checked "include" files from id3tag.library and the spelling is correct: ID3Tag)

Thanks for any help.
peceha is offline  
Old 28 September 2019, 22:25   #16
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 182
I have no idea if I'm doing this the right way but I decided to make a ID3Tag NEWTYPE by myself.

On the picture below you can se original structure (left) and BB2 (right).
I have 2 questions.
What should I do with: "void *tagdata" ? cannot find it anywhere
How to handle a name inside NEWTYPE which is recognized as BB2 internal command: "filesize" ?


Thanks
peceha is offline  
Old 29 September 2019, 02:10   #17
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,883
The name is of no importance. You can name it "Macintosh" and the compiler won't even notice.

What is important is the size and order of the fields.

Therefore, you must define tagdata. Define it as tagdata.l.
idrougge is offline  
Old 29 September 2019, 11:17   #18
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 182
Thanks.

What I have done so far is:
-converted FD file with included program
-updated deflibs file (for bb2)
-declared NEWTYPE.ID3Tag

What's the next step to make such external library work?
1) I think I should declare all constants (from id3tag includes) as BB2 contstans, yes?
2) I should also define the rest of structures as NEWTYPES:
ID3TagBase
ID3Tag_Language
ID3Tag_Image
... and others, yes?
3) if there are any macros than these should be also translated into bb2?



EDIT
I did all the steps above and it is working

Thanks for help!!!

If I experience any crash with that it will probably mean that some of my NewTypes are not correct. But I hope it is going to be easy to fix.

Last edited by peceha; 29 September 2019 at 13:32.
peceha is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
EDU - External Disk Unit | External gotek for Commodore Amiga with LCD & Sound arananet Amiga scene 7 02 April 2016 21:06
HELP: Opus5, KingCON, SysInfo.library (Sysmon.library) triangle Michael support.Apps 6 10 March 2014 14:08
Mediator - openpci.library and pci.library mardn78 support.Hardware 1 01 February 2014 11:11
Accessing dos.library during boot time Leffmann Coders. General 9 16 February 2009 19:26
Making a shared library from a gcc .a library JoJo Coders. General 1 10 March 2003 19:06

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:01.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.09158 seconds with 15 queries