Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added codegen, code reformatting, deprecated system.d
- Loading branch information
Showing
6 changed files
with
390 additions
and
336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
lib | ||
dub.selections.json | ||
.dub | ||
.dub | ||
dscanner.ini | ||
*.kate-swp | ||
.directory | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/+ | ||
+ Copyright 2022 – 2023 Aya Partridge | ||
+ Distributed under the Boost Software License, Version 1.0. | ||
+ (See accompanying file LICENSE_1_0.txt or copy at | ||
+ http://www.boost.org/LICENSE_1_0.txt) | ||
+/ | ||
module bindbc.loader.codegen; | ||
|
||
enum LoadMsg{ | ||
success, | ||
noLibrary, | ||
badLibrary, | ||
} | ||
|
||
enum makeDynloadFns = (string name, string libNames, string[] bindModules) nothrow pure @safe{ | ||
string dynloadFns = ` | ||
private SharedLib lib; | ||
@nogc nothrow{ | ||
void unload`~name~`(){ if(lib != invalidHandle) lib.unload(); } | ||
bool is`~name~`Loaded(){ return lib != invalidHandle; } | ||
LoadMsg load`~name~`(){ | ||
enum libNamesCT = `~libNames~`; | ||
const(char)[][libNamesCT.length] libNames = libNamesCT; | ||
LoadMsg ret; | ||
foreach(name; libNames){ | ||
ret = load`~name~`(name.ptr); | ||
if(ret == LoadMsg.success) break; | ||
} | ||
return ret; | ||
} | ||
LoadMsg load`~name~`(const(char)* libName){ | ||
lib = bindbc.loader.load(libName); | ||
if(lib == invalidHandle){ | ||
return LoadMsg.noLibrary; | ||
} | ||
auto errCount = errorCount(); | ||
`; | ||
|
||
foreach(mod; bindModules){ | ||
dynloadFns ~= "\n\t"~mod~".bindModuleSymbols(lib);"; | ||
} | ||
|
||
dynloadFns ~= ` | ||
if(errCount != errorCount()) return LoadMsg.badLibrary; | ||
return LoadMsg.success; | ||
} | ||
}`; | ||
|
||
return dynloadFns; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
|
||
// Copyright 2018 - 2021 Michael D. Parker | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
/+ | ||
+ Copyright 2023 – 2023 Aya Partridge | ||
+ Copyright 2018 - 2021 Michael D. Parker | ||
+ Distributed under the Boost Software License, Version 1.0. | ||
+ (See accompanying file LICENSE_1_0.txt or copy at | ||
+ http://www.boost.org/LICENSE_1_0.txt) | ||
+/ | ||
module bindbc.loader; | ||
|
||
public | ||
import bindbc.loader.sharedlib, | ||
bindbc.loader.system; | ||
public import | ||
bindbc.loader.sharedlib, | ||
bindbc.loader.codegen, | ||
bindbc.loader.system; |
Oops, something went wrong.