xref: /aoo42x/main/svtools/workben/cui/loadlib.cxx (revision 0495d53e)
1*5900e8ecSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5900e8ecSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5900e8ecSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5900e8ecSAndrew Rist  * distributed with this work for additional information
6*5900e8ecSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5900e8ecSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5900e8ecSAndrew Rist  * "License"); you may not use this file except in compliance
9*5900e8ecSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*5900e8ecSAndrew Rist  *
11*5900e8ecSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*5900e8ecSAndrew Rist  *
13*5900e8ecSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5900e8ecSAndrew Rist  * software distributed under the License is distributed on an
15*5900e8ecSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5900e8ecSAndrew Rist  * KIND, either express or implied.  See the License for the
17*5900e8ecSAndrew Rist  * specific language governing permissions and limitations
18*5900e8ecSAndrew Rist  * under the License.
19*5900e8ecSAndrew Rist  *
20*5900e8ecSAndrew Rist  *************************************************************/
21*5900e8ecSAndrew Rist 
22*5900e8ecSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svtools.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <stdio.h>
28cdf0e10cSrcweir #include <string.h>
29cdf0e10cSrcweir #include <stdlib.h>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <tools/string.hxx>
32cdf0e10cSrcweir #include <osl/module.h>
33cdf0e10cSrcweir #include <rtl/ustring.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir using namespace rtl;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir extern "C" {
38cdf0e10cSrcweir struct VersionInfo
39cdf0e10cSrcweir {
40cdf0e10cSrcweir         const char*     pUpd;
41cdf0e10cSrcweir         const char*     pMinor;
42cdf0e10cSrcweir         const char*     pBuild;
43cdf0e10cSrcweir };
44cdf0e10cSrcweir 
45cdf0e10cSrcweir typedef VersionInfo*(__LOADONCALLAPI *GetVersionInfo)(void);
46cdf0e10cSrcweir }
47cdf0e10cSrcweir 
main(int argc,char ** argv)48cdf0e10cSrcweir int __LOADONCALLAPI main( int argc, char **argv )
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 	VersionInfo *pInfo = NULL;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	if ( argc != 2 )
53cdf0e10cSrcweir 	{
54cdf0e10cSrcweir 		fprintf( stderr, "USAGE: %s DllName \n", argv[0] );
55cdf0e10cSrcweir 		exit(0);
56cdf0e10cSrcweir 	}
57cdf0e10cSrcweir     OUString aLib = OUString::createFromAscii(argv[1]);
58cdf0e10cSrcweir     oslModule aLibrary = osl_loadModule( aLib.pData, SAL_LOADMODULE_DEFAULT );
59cdf0e10cSrcweir     if ( aLibrary )
60cdf0e10cSrcweir     {
61cdf0e10cSrcweir         void* pFunc = osl_getSymbol( aLibrary, OUString::createFromAscii( "GetVersionInfo" ).pData );
62cdf0e10cSrcweir         if ( pFunc )
63cdf0e10cSrcweir             pInfo = (*(GetVersionInfo)pFunc)();
64cdf0e10cSrcweir     }
65cdf0e10cSrcweir 	if ( pInfo )
66cdf0e10cSrcweir 	{
67cdf0e10cSrcweir 		fprintf( stdout, "UPD : %s\n", pInfo->pUpd );
68cdf0e10cSrcweir 		fprintf( stdout, "Minor : %s\n", pInfo->pMinor );
69cdf0e10cSrcweir 		fprintf( stdout, "Build : %s\n", pInfo->pBuild );
70cdf0e10cSrcweir 	}
71cdf0e10cSrcweir 	else
72cdf0e10cSrcweir 		fprintf( stderr, "VersionInfo not Found !\n" );
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     if ( aLibrary )
75cdf0e10cSrcweir         osl_unloadModule( aLibrary );
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     return 0;
78cdf0e10cSrcweir }
79cdf0e10cSrcweir 
80