IonicWind Software

IWBasic => Object Oriented Programming => Topic started by: LarryMc on August 17, 2007, 09:39:55 PM

Title: loadresource inside a static lib
Post by: LarryMc on August 17, 2007, 09:39:55 PM
Still working on the same application.
I'm about to give up on being able to make my wysiwyg editor a class.

I have a lot of buttons with images that I have loaded as resources.
When the class methods are in the same source file as the calling dialog the loadresource method works great.(it's working in an exe file.)

When I separate and compile the class methods as a static lib and invoke it from my calling dialog which is now in a separate exe file the loadresource command doesn't work anymore.

FYI, in both cases the method that contains the loadresource command is called from another method in the class and not by my calling dialog.

It shouldn't be this hard to get this to work; the class file is less than 200 lines long.

Larry

Edit:
Reading about resources the term executable is used several times.  Right now I'm assuming that a static lib is not an "executable" and therefore it is normal for loadresource not to work.

If that is the case does anyone have any idea of how I can store about 40 .gifs, .htmls, and .css files in a static lib that can be gotten to at runtime?

Title: Re: loadresource inside a static lib
Post by: ts-soft on August 17, 2007, 10:09:19 PM
compile the resources with gorc or an other resource-compiler to a *.res. This file can you import with $USE "myresource.res"
The static lib can use it, loadresource is a runtime command
Title: Re: loadresource inside a static lib
Post by: Ionic Wind Support Team on August 17, 2007, 10:17:12 PM
A resource file is compiled binary file.  It is created by the resource compiler when you make your executable, and then linked in by the linker.  When you make a static library only your source code is compiled, not any resources.

Off the top of my head I don't remember if the binary resource file has a COFF header, which would be necessary to include it in a static lib.  Probably not since even with C if a static lib requires resources we normally drag and drop from one resource script to another before making the executable.

You could precompile the resources as ts-soft suggests, and include that with your package.  The GoRC manual is included with Emergence and is accessable from the help menu.

Paul.

Title: Re: loadresource inside a static lib
Post by: LarryMc on August 17, 2007, 10:23:28 PM
Thanks guys
.

got any ideas on my other major problem?
http://www.ionicwind.com/forums/index.php/topic,1857.0.html

Larry
Title: Re: loadresource inside a static lib
Post by: ts-soft on August 17, 2007, 10:38:47 PM
Quote from: Larry McCaughn on August 17, 2007, 10:23:28 PM
Thanks guys
.

got any ideas on my other major problem?
http://www.ionicwind.com/forums/index.php/topic,1857.0.html

Larry

I miss the resources, but a tip for you:
Add all resources as Typ HTML
example:
about.html HTML "about.html"
ts_avatar.gif HTML "ts_avatar.gif"

load in the browsercontrol only the first page with a url like this:
"res://" + getstartpath + "myprogramm.exe/ABOUT.HTML"

greetings
Thomas

Title: Re: loadresource inside a static lib
Post by: ts-soft on August 18, 2007, 12:11:33 AM
Here a short example with HTML-Resource
Title: Re: loadresource inside a static lib
Post by: LarryMc on August 18, 2007, 07:03:13 AM
Thomas
Great example!

Thanks,

Larry
Title: Re: loadresource inside a static lib
Post by: LarryMc on August 18, 2007, 06:32:42 PM
Thomas
your example "welcome.zip" works fine for pulling a html page from the .res file and passing it to the browser.

I haven't been able to figure out how to copy that file (inside the .res file) to the harddisk (which is what I need to do with other files in my .res file).

Maybe you or my man Sapero can show me how.

Larry

Title: Re: loadresource inside a static lib
Post by: ts-soft on August 18, 2007, 07:03:07 PM
Normal it isn't required to extact any html-resource type resource, but the html should not use a path to load a script, image or anything.

For extracting use:
length = GETRESOURCELENGTH("bla.html",  23)
and LOADRESOURCE("bla.thml", 23, mymem) and write this to disc

Not tested, but this way is described in the help and should work with all resourcetypes


Title: Re: loadresource inside a static lib
Post by: LarryMc on August 18, 2007, 07:25:09 PM
Duhhhhhh!
I was trying to make it 10 times harder than it was.
I already had the routine to do that.

Thanks Thomas


Larry
Title: Re: loadresource inside a static lib
Post by: ts-soft on August 18, 2007, 07:33:53 PM
Therefore I gave you the tip with HTML resource and res: //, makes that redundantly extract etc. and are simpler for your project  ;)