Page 1 of 1

External Dll does not refer to correct location. Please Help

Posted: Tue Jul 31, 2007 7:53 am
by pkmittal
Hello,

I want to use XML libary in my revolution stack. I have manually copied revxml.dll file to "My Data" folder which is located in the current directoy of standalone.

I am using the following code in OpenStack
put defaultFolder &"/My Data/" into DataFolderPath
put DataFolderPath & "revxml.dll" into myDLLfilePath
set the externals of me to into myDLLfilePath

When I run the standalone then It seems to refer dll from the path C:\Program Files\Revolution 2.6\My Data\revxml.dll because standalone for xml works fine when revxml.dll is located in My DATA folder present in revolution 2.6 directory.

Can you please help me in making this dll refer to correct path.

I have found the following thread for loading the dll in custom propery and then loading it at run time. do we really need to do that ?
http://forums.runrev.com/phpBB2/viewtop ... revxml+dll

Please let me know How I can bind revxml.dll from My Data folder present in standalone directory

Thanks for your help
Best Regards
Pradeep

Posted: Tue Jul 31, 2007 9:49 am
by Mark
Dear Pradeep,

Setting the externals property in the openStack handler doesn't work. If you read the documentation about the externals property, you will read that you would have to close and reopen the stack.

The following seems to work, although I believe it is undocumented.

Create a new stack "Externals Lib". Put a startUp handler into the card script of card 1 of the mainstack.

Code: Select all

on startUp
  put defaultFolder &"/My Data/" into DataFolderPath
  put DataFolderPath & "revxml.dll" into myDLLfilePath
  set the externals of stack "Externals Lib" to into myDLLfilePath
  send "openLib" to me in 0 millisecs
  pas startUp
end startUp
Also add the following handler to the script of the same card:

Code: Select all

on openLib
  go invisible stack "Externals Lib" in new window
  go back
end openLib
This way, you can load an external without closing and reopening the stack.

You don't need to load an external into a custom property.

Best,

Mark

Posted: Tue Jul 31, 2007 11:59 am
by Klaus
Dag MArk, salaam Pradeep,

The "startup" handler is the only place where you can set the external of your mainstack and then can use the externals afterwards, so messing around with a substack is not necessary!

So this is all you need:

Code: Select all

on startUp 
  put defaultFolder &"/My Data/" into DataFolderPath 
  put DataFolderPath & "revxml.dll" into myDLLfilePath 
  set the externals of this stack to myDLLfilePath
  pass startUp 
end startUp
I do this in all of my standalones and never had problems!

Best

Klaus

My Data folder for dll is not ready when appplication loads

Posted: Tue Jul 31, 2007 12:07 pm
by pkmittal
Dear Mark,

Thanks for the solution. I tried your code in plain stack and it seems to work fine.

But In my main application, "My Data" folder is downloaded when I clicked on authenticate button on first card. So I can not use startup handler that because I do not have dll at that time.

Once the atuthenticate is successful then "My Data" is downloaded with the revxml.dll etc. and then it opens up another substack which uses the xml features.

Is there any way, so that I can bind the dll at some other place (after the first card )?

Any trick/solution to do that in rev?

Thanks
Best Regards
Pradeep

Posted: Tue Jul 31, 2007 12:30 pm
by Klaus
Salaam Pradeep,

in that case you can use this handler right after the dll has been downloaded (succesfully ;-)):

Code: Select all

on create_externals_stack_and_use_it_right_away
  put defaultFolder &"/My Data/" into DataFolderPath 
  put DataFolderPath & "revxml.dll" into myDLLfilePath
  create invisible stack "Externals Lib"
  set the externals of stack "Externals Lib" to myDLLfilePath 
  start using stack "Externals Lib"
end create_externals_stack_and_use_it_right_away
You can of course use a shorter name for the handler ;-)


Regards

Klaus

Posted: Tue Jul 31, 2007 12:31 pm
by Mark
Hi Pradeep,

In your case, the solution with a dll stored in a custom property might be exactly what you need. Distribute the standalone with the dll in a custom property and write the dll to disk on startUp. Then continue the startUp handler as I explained above.

Klaus, I tried loading the revFont external without separate substack and it didn't work.

Best,

Mark

Posted: Tue Jul 31, 2007 12:33 pm
by Klaus
Dag Mark,

hmmm, in the "startup" handler?
This is the official palce to do so...

I do this all the time in my apps and it always worked for me...?

Posted: Tue Jul 31, 2007 12:33 pm
by Mark
Klaus posted another reply while I was writing my answer. Sure, you can also download the dll from a server rather than store it in a custom property.

Mark

Posted: Tue Jul 31, 2007 12:59 pm
by Mark
Gutentag Klaus,

Sure I believe you and I don't know why it didn't work for me, but I do think that using a substack is the safest way to get it to work. Are you using MetaCard perhaps?

Best,

Mark

Posted: Tue Jul 31, 2007 1:11 pm
by Klaus
Hi Mark,

yes, I am always using MetaCard ;-)
But this works for me even if I let REV build my standalones!

Posted: Tue Jul 31, 2007 2:37 pm
by Mark
Hi Klaus,

If I ever find out why it doesn't always work for me, I'll let you know.

Best,

Mark