Thank you very much for your help Yeti.

It turns out that you were right - the crash occurred because I was  
trying to print the NULL pointer as string. While I figure out a more  
robust way to load the modules, for now I register them with the  
absolute path.

I now find that while the loading seems to work, trying to export to  
one of the pixmap formats gives an error "file contains no exportable  
channel." I've read that exporting to the pixmap format can be lossy,  
but I notice that it seems to work if I try to open and 'save as'  
within Gwyddion. Is there any processing required between the  
gwy_file_load and gwy_file_save functions?

As I can't seem to find many helpful examples, any help would be much  
appreciated.

Ryan


Quoting "David Necas (Yeti)" <[email protected]>:

> On Tue, Jun 22, 2010 at 11:44:44AM -0400, Ryan Speller wrote:
>> I've been trying to use the libraries provided (in C++) to write a
>> program that loads one of the supported file types, and then exports
>> to another format. I'm currently using Microsoft Visual Studio 2010 on
>> a 64-bit Vista machine. I've run in to some difficulty lately I've
>> been unable to resolve as yet - it seems that gwy_file_load fails,
>> throwing the error " Cannot load `sample.mi': No module can load this
>> file type." This failure persists for any file type I try, supported
>> or not.
>
> Please post a complete compilable source, if possible.
>
> The initialisation part looks OK, however, since it seems like no module
> is actually loaded the problem might be that the libs fail to find the
> module directory when run from something else than Gwyddion.  You can
> easily see what modules are loaded by doing e.g.
>
> gwy_module_foreach((GHFunc)&print_module, NULL);
>
> with
>
> static void
> print_module(const gchar *name)
> {
>     cout << name << endl;
> }
>
>> gchar *mpath = gwy_find_self_dir("");
>> gchar *importfilenamefull = g_build_filename(mpath, "\\" , filename, NULL);
>> gchar *exportfilenamefull = g_build_filename(mpath, "\\" , filename,
>> ".", extension, NULL);
>> gchar *gfilename =
>> g_filename_from_utf8(gwy_canonicalize_path(importfilenamefull), -1,
>> NULL, NULL, &err);
>
> I don't understand why you start with gwy_find_self_dir(), is the file
> in directory where Gwyddion was installed?  Just use normal absolute
> path.
>
>> /* Detect File Type -- Crashes! */
>> //std::cout << gwy_file_detect(gfilename, TRUE,
>> GWY_FILE_OPERATION_LOAD) << std::endl;
>
> Does it really crash in gwy_file_detect()?  Because if you get ‘No
> module can load this file type.’ you almost surely also get NULL
> returned from gwy_file_detect() and then it crashes when trying to print
> the NULL pointer as string.
>
> Please always use gwy_file_detect() with only_name=FALSE for loading of
> existing files.  The detection function unfortunately allows
> combinations of arguments that do not make much sense.
>
>> is uncommented, nomatter what filename I put in there - the debugger
>> shows this occurs on the following line in the stack:
>>
>> main_loop:
>>          mov     eax,dword ptr [ecx]     ; read 4 bytes
>
> Is this a full stack trace?  There does not seem to be any function
> named main_loop in Gwyddion, Gtk+ or GLib so I don't know how it got
> there.
>
> Regards,
>
> Yeti
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Gwyddion-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gwyddion-users
>





------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Gwyddion-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gwyddion-users

Reply via email to