Hi, librt usually opens a .g file using db_open(<g file>) and then populates 
struct db_i. I am working on a viewer application that has all the bytes of a 
.g file in a buffer (no file) and I have to populate struct db_i. It's not 
possible for me to call db_open (as it requires filename). Sean has been kind 
enough to guide me and from what I understood from his suggestions, I have to:

call db_open_inmem
Then point the g file bytes to "dbip->dbi_mf" and dbip->dbi_eof
Finally call db_dirbuild()

I am a bit stuck at pointing the g file bytes to "dbi_mf" 
(http://brlcad.sourceforge.net/doxygen/d1/d41/structbu__mapped__file.html), 
dbi_mf is a struct that has element "genptr buf" which contains copy of the g 
file but I cannot point my g file bytes to this pointer. Do you guys have any 
suggestions?


PS: I am able to create a temp file and writing my gbytes to that file and then 
calling db_open on that file but that seems to hacky and I want a cleaner 
approach.
Cheers,

Technische Universität München
Syed Asadullah Hussain
MS Informatik
https://github.com/asadpiz/brlcad-viewer


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to