how to check for is error 126 in advance?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

how to check for is error 126 in advance?

jtuchel
hi

how can I check (e.g. on application startup) if a certain DLL/lib can be found/loaded.

I know I could issue a call and wrap it in proper exception handling blocks. but I'd like to do something like dlopen() just to see if it is there. Thus I don't have to implement individual calls for each required lib/DLL

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: how to check for is error 126 in advance?

SebastianHC
Hi Joachim,

for your own dll, you should have the general path/resource information
in your abt.ini,... I would just check for existence based on the Cfs-layer.
The next step would be checking the registry or PATH variables for the
dll entry....

Don't forget to check for the access rights on those directories. I had
issues on that one before....

Sebastian

Am 19.04.2013 10:40, schrieb [hidden email]:

> hi
>
> how can I check (e.g. on application startup) if a certain DLL/lib can
> be found/loaded.
>
> I know I could issue a call and wrap it in proper exception handling
> blocks. but I'd like to do something like dlopen() just to see if it
> is there. Thus I don't have to implement individual calls for each
> required lib/DLL
>
> Joachim
> --
> You received this message because you are subscribed to the Google
> Groups "VA Smalltalk" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [hidden email].
> To post to this group, send email to [hidden email].
> Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: how to check for is error 126 in advance?

Marten Feldtmann-2
In reply to this post by jtuchel
I would think, that getting an address of a platform function should be ok to know, if the library is available.


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: how to check for is error 126 in advance?

jtuchel
In reply to this post by SebastianHC
Hi Sebastian,

hmm. Sounds like quite some coding for a simple check. But it's sure better than just waiting if the first call fails...

I was hoping for a method that's equivalent to dlopen, which would do all of that and throw an error if it's not found.

Joachim

Am Freitag, 19. April 2013 19:45:39 UTC+2 schrieb Sebastian Heidbrink:
Hi Joachim,

for your own dll, you should have the general path/resource information
in your abt.ini,... I would just check for existence based on the Cfs-layer.
The next step would be checking the registry or PATH variables for the
dll entry....

Don't forget to check for the access rights on those directories. I had
issues on that one before....

Sebastian

Am 19.04.2013 10:40, schrieb <a href="javascript:" target="_blank" gdf-obfuscated-mailto="IwrBsG55ObsJ">jtu...@...:

> hi
>
> how can I check (e.g. on application startup) if a certain DLL/lib can
> be found/loaded.
>
> I know I could issue a call and wrap it in proper exception handling
> blocks. but I'd like to do something like dlopen() just to see if it
> is there. Thus I don't have to implement individual calls for each
> required lib/DLL
>
> Joachim
> --
> You received this message because you are subscribed to the Google
> Groups "VA Smalltalk" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="IwrBsG55ObsJ">va-smalltalk...@googlegroups.com.
> To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="IwrBsG55ObsJ">va-sma...@....
> Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: how to check for is error 126 in advance?

jtuchel
In reply to this post by Marten Feldtmann-2
Marten,

I am not sure I understand your comment. I would like to start my web server and check for availability of libs/dlls right at the start so that I can present some web page with error information rather than wait for the first call to fail.

But maybe you are saying there is a way to ask for a function's address without actually calling it. How can I do that?

Joachim

Am Freitag, 19. April 2013 20:25:01 UTC+2 schrieb Marten Feldtmann:
I would think, that getting an address of a platform function should be ok to know, if the library is available.


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: how to check for is error 126 in advance?

SebastianHC
Joachim,

checking if a file exists in a directory should be a lot of codeing. accessing the abt.ini also.

For the registry stuff check the method "abtScanEnv", or so.
I hope I have that right in mind...

Sebastian

Am 19.04.2013 22:06, schrieb [hidden email]:
Marten,

I am not sure I understand your comment. I would like to start my web server and check for availability of libs/dlls right at the start so that I can present some web page with error information rather than wait for the first call to fail.

But maybe you are saying there is a way to ask for a function's address without actually calling it. How can I do that?

Joachim

Am Freitag, 19. April 2013 20:25:01 UTC+2 schrieb Marten Feldtmann:
I would think, that getting an address of a platform function should be ok to know, if the library is available.


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: how to check for is error 126 in advance?

Marten Feldtmann-2
Example:

functionName :=
            PlatformFunction fromArray: (
                Array
                    with: 'C'
                    with: 'ucal_getNow_49'
                    with: nil
                    with: libraryName
                    with: Array new
                    with: #double).
value := functionName address.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: how to check for is error 126 in advance?

Hermann Ottens
In reply to this post by jtuchel
Hi Joachim,

in case you're still looking for a simple code that should work on Windows (we're using VAST 8.5.2, but iirc it works also in 7.0, 7.5):

 | module fileName |

fileName := 'your.dll'. "fileName can be fully qualified"
"get DLL handle to see if it is already loaded"
(module := OSHmodule getModuleHandle: fileName) isNull ifTrue:
  ["load the DLL"
  module := OSHmodule loadLibrary: fileName].
module isNull not ifTrue:
  ["free the DLL"
  module freeLibrary ifFalse: ["could not unload the dll"]]

On Windows you can check the DLLs loaded by your program with ProcessExplorer (SysInternals).

Hermann

Am Freitag, 19. April 2013 19:40:08 UTC+2 schrieb [hidden email]:
hi

how can I check (e.g. on application startup) if a certain DLL/lib can be found/loaded.

I know I could issue a call and wrap it in proper exception handling blocks. but I'd like to do something like dlopen() just to see if it is there. Thus I don't have to implement individual calls for each required lib/DLL

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: how to check for is error 126 in advance?

jtuchel
Hi Hermann,

that's exactly the kind of code I was looking for:
Just try to load the DLL / Lib and see if that works, without setting up all the stuff that's needed to call any specific function in it.

Unfortunately, my deployment platform is Linux. On Linux there neither is a Class named OSHmodule nor another implementor of #loadLibrary: . So I am afraid I'll either have to chose one of the other approaches or simply keep my code as it is. It does catch errors, but only at first invocation of external functions, so it's not too bad. I just would have liked to see problems in a startup log of my server application.

Joachim

Am Dienstag, 23. April 2013 16:25:30 UTC+2 schrieb Hermann Ottens:
Hi Joachim,

in case you're still looking for a simple code that should work on Windows (we're using VAST 8.5.2, but iirc it works also in 7.0, 7.5):

 | module fileName |

fileName := 'your.dll'. "fileName can be fully qualified"
"get DLL handle to see if it is already loaded"
(module := OSHmodule getModuleHandle: fileName) isNull ifTrue:
  ["load the DLL"
  module := OSHmodule loadLibrary: fileName].
module isNull not ifTrue:
  ["free the DLL"
  module freeLibrary ifFalse: ["could not unload the dll"]]

On Windows you can check the DLLs loaded by your program with ProcessExplorer (SysInternals).

Hermann

Am Freitag, 19. April 2013 19:40:08 UTC+2 schrieb [hidden email]:
hi

how can I check (e.g. on application startup) if a certain DLL/lib can be found/loaded.

I know I could issue a call and wrap it in proper exception handling blocks. but I'd like to do something like dlopen() just to see if it is there. Thus I don't have to implement individual calls for each required lib/DLL

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: how to check for is error 126 in advance?

Thomas Koschate-2
On Wednesday, April 24, 2013 9:20:38 AM UTC-4, [hidden email] wrote:

Unfortunately, my deployment platform is Linux.

 It's becoming increasingly apparent that all your problems are because you insist on doing things in Linux.  If you'd just give up, go with the flow, and work exclusively in Windows instead of some obscure operating system that will never catch on anyway, all would be well.  :{)

Tom

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: how to check for is error 126 in advance?

Marten Feldtmann-2
In reply to this post by jtuchel
Joachim,

whenever working with external functions - use instances of PlatformFunctions and not the pragma style, tough it may be faster in the first round.

When you have reached this state of programming you may use several methods on the instance side of PlatformFunction or instance side/class side of PlatformLibrary to get what you want ...

When working on different platforms use PlatformLibrary and logical- und physical name mapping definitions during startup. No need to use any special OS functions to get the work done.

Otherwise you may look at my MSKICU config map, where I - during startup - look for several versions of ICU, tries to load different versions of ICU and when I know, which version is available I have to change the function names. More or less everything you want to do ...


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: how to check for is error 126 in advance?

jtuchel
In reply to this post by Thomas Koschate-2
Tom,

you should be careful. You never know who's going to haunt you in your next couple of nightmares :().
I'd say Linux accounts for a significant percentage of virtual and physical root servers on the web. And it is a supported platform of Vast, if I remember correctly.

I'm gonna tell my older brother about your post!

Joachim

Am Donnerstag, 25. April 2013 14:05:34 UTC+2 schrieb Thomas Koschate:
On Wednesday, April 24, 2013 9:20:38 AM UTC-4, [hidden email] wrote:

Unfortunately, my deployment platform is Linux.

 It's becoming increasingly apparent that all your problems are because you insist on doing things in Linux.  If you'd just give up, go with the flow, and work exclusively in Windows instead of some obscure operating system that will never catch on anyway, all would be well.  :{)

Tom

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: how to check for is error 126 in advance?

jtuchel
In reply to this post by Marten Feldtmann-2
Marten,

I've given up on pragma style function calls, a while ago, because I needed to use futures, which is only possible with instances of PlatformFunction.


The startup behavior of your MSKICU LIBRARY sounds interesting, I should take a look at it.


Am Donnerstag, 25. April 2013 14:47:20 UTC+2 schrieb Marten Feldtmann:
Joachim,

whenever working with external functions - use instances of PlatformFunctions and not the pragma style, tough it may be faster in the first round.

When you have reached this state of programming you may use several methods on the instance side of PlatformFunction or instance side/class side of PlatformLibrary to get what you want ...

When working on different platforms use PlatformLibrary and logical- und physical name mapping definitions during startup. No need to use any special OS functions to get the work done.

Otherwise you may look at my MSKICU config map, where I - during startup - look for several versions of ICU, tries to load different versions of ICU and when I know, which version is available I have to change the function names. More or less everything you want to do ...


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.