headers (.bi) for Implicit linking (Windows)

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Post Reply
Axle
Posts: 41
Joined: May 31, 2022 6:49
Location: Australia

headers (.bi) for Implicit linking (Windows)

Post by Axle »

Hi Forum

This is a question for anyone familiar with creating FreeBASIC includes and headers.

I am currently working through the conversions of the more recent version/s of raylib and some other associated headers.
My goal is to create the headers for Implicit linking only to the raylib+.dll. Following previous raylib.bi examples, and raylib being made up a single file headers, includes both declarations as well as the initialization and functions normally found in the source.c file.

The previous raylib.bi etc include both declarations as well as the initialization and functions, which is necessary for static linking, but not for runtime linking. So I have done the base conversions with all functions included (<- complex and quite a bit of effort).

It just occurred to me that for Implicit linking to the dll I should really only require the header definitions, as all of the functions are in the dll and initialized from the dll.

So, my question is:
1. Do you think I am on the right track in the context of FreeBASIC and creating the headers with only the header declarations for Implicit linking only?
(aka remove all functions/subs from the headers.)
2. As FB relies on numerous dlls with implicit linking, could you point me to a good example from .\FB\inc\*.bi that that makes use of Implicit Linking only? Just as a guide to check myself against.

In reality I should be able to use the dlls (or .so) with explicit linking and not require a header at all, but implicit just makes it a little simpler.
(Just so its clear. The headers will have no capacity for static linking)

Regards
Axle
dodicat
Posts: 7522
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: headers (.bi) for Implicit linking (Windows)

Post by dodicat »

Searching for dylibload in the inc folder (and all folders inside the inc folder), there are none.
I think you might have to do the runtime calling functions by hand from a .bi file as a starter.
Maybe you could do some find and replace in the .bi, you could automate it somewhat.
What is raylib.bi anyway?
Any constants should stand OK, how many subs and functions does it contain?
Axle
Posts: 41
Joined: May 31, 2022 6:49
Location: Australia

Re: headers (.bi) for Implicit linking (Windows)

Post by Axle »

Hey, thanks for the reply @dodicat

"Searching for dylibload..." That's for explicit linking. I want to use implicit linking. I should be able to as if it was a standard header and C source for conversion to FB.bi. I would assume only the C header definitions would be required as the functions are already in the lib*dll file.

raylib is a C99 graphics + GUI library.
There are several hundred, so maybe 10,000 15,000 lines in the source.

I just assume that other examples included in the FB inc/lib folders are also created for static linking, but I want to eliminate any static linking and use the lib.dll only.
dodicat
Posts: 7522
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: headers (.bi) for Implicit linking (Windows)

Post by dodicat »

#inclib will load dynamic libraries also.
So will lib
simple.bas to simple.dll

Code: Select all

#cmdline "-dll"
#include "dir.bi" 

function list_files (ByRef filespec As String, ByVal attrib As Integer) as string
    Dim As String s,filename = Dir(filespec, attrib) 
    Do While Len(filename) > 0 
        s+=filename+chr(13,10)
        filename = Dir() 
    Loop
    return s
End function



function start() as string export
return list_files ("*", fbArchive)
end function

 
test code

Code: Select all


#inclib "simple"

declare function start() as string
'or
'declare function start lib "simple"alias "START"() as string
print start
sleep 
So long as the dll is in the same folder as the test code.
The import lib libsimple.dll.a is not needed, you can delete it.
Post Reply