Comments (12)
It appears to me that (by looking through the amalgamation header) this issue exists for the following functions:
- bitset_size_in_bytes
- bitset_size_in_bits
- bitset_size_in_words
- bitset_set
- bitset_set_to_value
- bitset_get
- bitset_next_set_bit
- bitset_next_set_bits
- bitset_for_each
- bitset_print
- roaring_bitmap_create (can be simulated with roaring_bitmap_create_with_capacity(0))
- roaring_bitmap_init_cleared (can be simulated with roaring_bitmap_init_with_capacity(r, 0))
- roaring_bitmap_get_copy_on_write
- roaring_bitmap_set_copy_on_write
- roaring_bitmap_add_range
- roaring_bitmap_remove_range
If there's no workaround, would you accept a PR that would remove the "static inline" modifiers from the implementations and headers? Oops, they seem to only exist in the header.
from croaring.
Try this, create a header file with the following content (call it "myheader.h"):
static inline void myfunction() {
}
Then create a source file (say "source.c"):
#include "myheader.h"
extern inline void myfunction();
Then compile it:
cc -std=c99 -c source.o
Look at the symbols...
$ objdump -T source.o
You will find that myfunction
is one of the symbols.
from croaring.
The maintainers of ffigen appear to claim that this is the case because static inline functions are not available in static libraries.
We had a few missing 'extern'. It does not explain your issue because many of the functions that you provided had extern declaration. Nevertheless, release 1.2.0 has a more complete list of extern declarations.
from croaring.
I ran the following command nm -gU libroaring.dylib to look for exported symbols, and bitset_set (which is static inline) does not appear to be exported.
As I wrote above, we had a few missing externs. As of 1.2.0, they should be all present. You can verify...
$ cc -std=c99 -c roaring.c && objdump -T roaring.o | grep roaring_bitmap_add_range
In file included from roaring.c:57:
0000000000020150 l 0e SECT 01 0000 [.text] _roaring_bitmap_add_range
000000000001f2bc g 0f SECT 01 0000 [.text] _roaring_bitmap_add_range_closed
$ cc -std=c99 -c roaring.c && objdump -T roaring.o |grep bitset_size_in_bytes
0000000000002d90 l 0e SECT 01 0000 [.text] _bitset_size_in_bytes
So I am going to close this issue.
Pull requests are invited, but we do want several of our functions to be inline.
We have multiple wrappers for CRoaring in other programming languages. I personally wrote two (Go and Swift) and I have contributed to others (e.g., Python, JavaScript). It definitively does work.
from croaring.
@lemire Thank you for the quick and thorough response. I agree that inline should be kept (it was intended as a rather naive attempt in proposing a solution as I'm not intimately familiar with the inner workings of the C/C++ toolchains.)
I think the issue still persists. It looks to me like the difference in results can be explained by me trying to make use of CRoaring as a statically linked library (i.e. a dylib on macos) and you are compiling it to an object file, could that be it?
Furthermore, if I search for bitset_set
in RoaringBitmap.swift I can't find it. Could it be that most bindings do not make use of bitsets?
If I change the "static" to "extern" in the amalgamated header file, then bitset_set becomes visible:
// get version 1.2.0
./amalgamation.sh
// change some "static" in roading.h to "extern"
cc -O3 -std=c11 -shared -o libroaring.dylib -fPIC roaring.c
nm -gU libroaring.dylib | grep bitset_set
0000000000001f84 T _bitset_set
Could it be that the amalgamated header file is also missing those extern annotations?
from croaring.
I.e., when I change the static here to extern, then that appears to solve the issue in the issue description:
CRoaring/include/roaring/bitset/bitset.h
Line 91 in e29535b
from croaring.
Proposed solution: #489
from croaring.
The extern qualifier is fine but we can’t export the same function more than once in the library. This means that, typically, you must use the extern declarations in the source files, not in the header files.
from croaring.
Got it, thank you. See: #489 (comment)
from croaring.
statically linked library
Note that dylib refers to a shared library, not a static library.
from croaring.
Furthermore, if I search for bitset_set in RoaringBitmap.swift I can't find it. Could it be that most bindings do not make use of bitsets?
The bindings rarely cover the entire API. However, the Swift wrapper includes roaring_bitmap_add_range
.
The Python wrapper also includes it...
The D wrapper includes it...
The Zig wrapper includes it...
I could keep going...
from croaring.
@lemire thank you for pointing this out. I apologize for any confusion that my misuse of terminology must have caused.
from croaring.
Related Issues (20)
- roaring64: and_inplace gives incorrect value HOT 1
- roaring64: or_inplace gives incorrect values HOT 2
- Wrong result for roaring64_bitmap_contains_range HOT 1
- Roaring64 iterator cannot come back from the edge
- Roaring64 iterator's move_equalorlarger can only go forward
- Copying a Roaring64MapSetBitForwardIterator into an iterator from another map does not work HOT 1
- Feature request: intersection, union, and difference with the tail of another bitmap HOT 4
- Segfault with roaring64_bitmap_flip_inplace HOT 4
- roaring64_iterator_move_equalorlarger cannot come back from the end
- How to use `containsRange` in roaring64 HOT 1
- Improve lazyor in CRoaring HOT 1
- Compiling croaring as C++ fails on Windows
- No github release/tag for 3.0.0 HOT 1
- Compilation issues with oldest clang versions with 3.0.0 HOT 1
- Allow allocating container in memory pool HOT 6
- Add a function to move the iterator to be equal or smaller than a value HOT 5
- Implement roaring64_bitmap_statistics HOT 10
- Avoid calculating the sum of items in bitmap statistics HOT 3
- Roaring - OR Operation - High memory usage in Oracle Linux 8(OEL8) when compared to Oracle Linux 7 (OEL7) HOT 5
- access the nullptr in function "run_container_is_full" HOT 5
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 croaring.