What will probably work best is to call db_open_inmem, then set dbip->dbi_mf and dbip->dbi_eof to the .g file bytes you read and size of the data. Once you set the mf pointer to the .g data, hopefully db_dirbuild() will work. A good test will be to check if dbip->dbi_title gets set or if you can db_lookup() a particular object in the .g file.
Haven't tested, but it might just work. Even if there’s a problem, shouldn’t be too hard to get it working. As for objcopy vs cat, I’d be rather surprised if objcopy handles the .g data correctly because it’s only supposed to handle .o files (which have a very specific file format). Cheers! Sean > On Jun 29, 2016, at 10:32 PM, (Asad) Syed, Asadullah Hussain > <asadullah.huss...@tum.de> wrote: > > Hi, I implemented this concatenation using object file (see my previous email) > The issue now is with calling “db_open” because it can only take .g file name > as an argument > > db_open(const char *name, const char *mode) > > But we only have an executable in which we know where the .g header bytes > start and end. How should I pass these bytes to db_open? or I need to > implement db_open by using lower function calls in my source? > > From: Christopher Sean Morrison [mailto:brl...@mac.com] > Sent: 29 June 2016 00:56 > To: BRL-CAD Developer Mailing List <brlcad-devel@lists.sourceforge.net> > Subject: Re: [brlcad-devel] #brlcad IRC availability times > > > Most that can help with libdm, librt are GMT-4. Mailing list should work; > was a message to the list missed? The more specifically you can frame a > question, the easier it will be to answer and provide some guidance. > > Before involving libdm, you'll want to first get librt reading .g data that > has been appended onto a binary application. For that, it might make sense > to first write a "compiler" program that concatenates a .g onto the end. > I.e., > > Program1 from a gviewer.c source you write: > gviewer.exe > # takes no arguments, fopens argv[0] and scans the file for a valid .g header. > # if it finds the header, just print out the title after a db_open() > > Program2 from a gcompiler.c source you write: > gcompiler.exe -o moss.exe gviewer.exe moss.g > # fopens viewer.exe and moss.g, writes all the bytes to both to moss.exe > > That's it. If you have a non-Windows box handy, you can skip program2, skip > writing gcompiler.c and just use the 'cat' program. Then you just need to > write gviewer.c, find the .g header bytes, then db_open it. > > Cheers! > Sean > > > On Jun 28, 2016, at 04:13 PM, "(Asad) Syed, Asadullah Hussain" > <asadullah.huss...@tum.de> wrote: > > Hi, I am a ESA Summer of Code student > (http://brlcad.org/wiki/Geometry_Viewer_Application_for_BRL-CAD) and > completely new to brlcad source. I need some help especially with libdm, > librt but unfortunately mailing list/irc communication is proving to be > difficult. So I thought maybe it’s due to time zone difference (I am GMT+2). > > Can anyone tell me the time period during which brlcad developers are online > at IRC (#brlcad). > > > LG, > > Technische Universität München > Syed Asadullah Hussain > MS Informatik > > > ------------------------------------------------------------------------------ > 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 > ------------------------------------------------------------------------------ > 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 ------------------------------------------------------------------------------ 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