Comments (2)
Here's a comment that should explain that:
Line 3011 in f0ec0de
But if it's more annoying than useful, then it's the wrong default. It would be interesting to run all of fbbindings with the opposite default and without the -addforwarddecl options, to see how many -noforwarddecl options would be needed.
from fbfrog.
Ah, thanks. There's also another comment here that discusses the issue:
Line 1453 in f0ec0de
Since FILE, etc, in standard headers are the main reason for this behaviour I think you could say the problem is that fbfrog doesn't know what's in them. If we added minimal include/fbfrog/stdio.h, etc headers which only declared common structs then there may be minimal need for -noforwarddecl. I would also argue that -fbfroginclude for standard headers could be the default: translating system headers is a special case for which automatic inclusion could be disabled (-nofbfrogincludes), and likely no end user is ever going to be doing so.
I'm currently testing it in fbbindings. It's 263 -addforwarddecl's that can all be removed, and it also reveals more that are missing from various headers. There are about 204 forward declarations introduced (109 unique ones), the majority of which are common ones from crt/posix, winapi or opengl although most occur only 1-2 times:
> git diff inc/ | grep "+\s*type.* as " | sed -e 's/+\s*//' | sort | uniq --count | sort -n | tail -n 20
2 type HWND as HWND_
2 type iconv_t as iconv_t_
2 type SOCKET as SOCKET_
2 type timeval as timeval_
2 type UBYTE as UBYTE_
2 type UINT as UINT_
2 type ULONG as ULONG_
2 type USHORT as USHORT_
2 type z_stream as z_stream_
3 type iovec as iovec_
3 type LONG as LONG_
3 type lua_State as lua_State_
3 type off_t as off_t_
3 type stat as stat_
4 type HDC as HDC_
5 type tm as tm_
6 type jmp_buf as jmp_buf_
12 type time_t as time_t_
22 type va_list as va_list_
24 type FILE as FILE_
Come to think of it, wouldn't the real solution be to modify fbc to allow
type T as T
type T
a as integer
end type
Why not?
from fbfrog.
Related Issues (7)
- Null pointer acces / segfault in util-has.bs HOT 1
- Cast necessary after integer promotion sometimes omitted HOT 3
- Comment without newline in .fbfrog file causes error
- Convert _Bool to boolean HOT 4
- Support newer FreeBSD and add support for Solaris (OpenIndiana) and DragonflyBSD HOT 3
- Update fbfrog to generate FreeBASIC binding from C++ headers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fbfrog.