Kaydet (Commit) 9e7bdb42 authored tarafından Andrzej Hunt's avatar Andrzej Hunt

Kill the libreofficekit static library / shim.c.

It looks like the cleanest method of getting lok_init into
a LibreOfficeKitInit.h header (in a c89 compatible way) is to
have it as a static function.

(inline is only available in C99 or later -- this is actually
 available on Linux which is the only place that we can actually
 use lok_init anyways currently, however given we have to keep
 c89 for the C code (for MSVC) compatibility, selectively enabling
 c99 would likely be more messy.)

Change-Id: I0493e7a68ed5397479220bb6ba8c3db870b6dd32
üst 30084592
...@@ -105,8 +105,6 @@ struct _LibreOfficeKitDocumentClass ...@@ -105,8 +105,6 @@ struct _LibreOfficeKitDocumentClass
#endif // LOK_USE_UNSTABLE_API #endif // LOK_USE_UNSTABLE_API
}; };
LibreOfficeKit* lok_init (const char* pInstallPath);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -7,17 +7,24 @@ ...@@ -7,17 +7,24 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
#ifdef LINUX #ifndef INCLUDED_DESKTOP_INC_LIBREOFFICEKIT_INIT_H
#define INCLUDED_DESKTOP_INC_LIBREOFFICEKIT_INIT_H
#include "LibreOfficeKit.h"
#ifdef __cplusplus
extern "C"
{
#endif
#if defined(__linux__) || defined(_AIX)
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sal/types.h>
#include <LibreOfficeKit/LibreOfficeKit.h>
#include <dlfcn.h> #include <dlfcn.h>
#ifdef AIX #ifdef _AIX
# include <sys/ldr.h> # include <sys/ldr.h>
#endif #endif
...@@ -26,7 +33,7 @@ ...@@ -26,7 +33,7 @@
typedef LibreOfficeKit *(HookFunction)( const char *install_path); typedef LibreOfficeKit *(HookFunction)( const char *install_path);
SAL_DLLPUBLIC_EXPORT LibreOfficeKit *lok_init( const char *install_path ) static LibreOfficeKit *lok_init( const char *install_path )
{ {
char *imp_lib; char *imp_lib;
size_t partial_length; size_t partial_length;
...@@ -58,7 +65,8 @@ SAL_DLLPUBLIC_EXPORT LibreOfficeKit *lok_init( const char *install_path ) ...@@ -58,7 +65,8 @@ SAL_DLLPUBLIC_EXPORT LibreOfficeKit *lok_init( const char *install_path )
dlhandle = dlopen(imp_lib, RTLD_LAZY); dlhandle = dlopen(imp_lib, RTLD_LAZY);
if (!dlhandle) if (!dlhandle)
{ {
fprintf(stderr, "failed to open library '%s' or '%s' in '%s/'\n", TARGET_LIB, TARGET_MERGED_LIB, install_path); fprintf(stderr, "failed to open library '%s' or '%s' in '%s/'\n",
TARGET_LIB, TARGET_MERGED_LIB, install_path);
free(imp_lib); free(imp_lib);
return NULL; return NULL;
} }
...@@ -77,6 +85,12 @@ SAL_DLLPUBLIC_EXPORT LibreOfficeKit *lok_init( const char *install_path ) ...@@ -77,6 +85,12 @@ SAL_DLLPUBLIC_EXPORT LibreOfficeKit *lok_init( const char *install_path )
return pSym( install_path ); return pSym( install_path );
} }
#endif // not LINUX => port me ! #endif // defined(__linux__) || defined(_AIX)
#ifdef __cplusplus
}
#endif
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -42,10 +42,6 @@ endif ...@@ -42,10 +42,6 @@ endif
$(eval $(call gb_CppunitTest_use_sdk_api,libreofficekit_tiledrendering)) $(eval $(call gb_CppunitTest_use_sdk_api,libreofficekit_tiledrendering))
$(eval $(call gb_CppunitTest_use_static_libraries,libreofficekit_tiledrendering,\
libreofficekit \
))
$(eval $(call gb_CppunitTest_use_ure,libreofficekit_tiledrendering)) $(eval $(call gb_CppunitTest_use_ure,libreofficekit_tiledrendering))
#$(eval $(call gb_CppunitTest_use_vcl,libreofficekit_tiledrendering)) #$(eval $(call gb_CppunitTest_use_vcl,libreofficekit_tiledrendering))
......
...@@ -14,10 +14,6 @@ $(eval $(call gb_Library_use_externals,libreofficekitgtk,\ ...@@ -14,10 +14,6 @@ $(eval $(call gb_Library_use_externals,libreofficekitgtk,\
gtk \ gtk \
)) ))
$(eval $(call gb_Library_use_static_libraries,libreofficekitgtk,\
libreofficekit \
))
$(eval $(call gb_Library_add_cobjects,libreofficekitgtk,\ $(eval $(call gb_Library_add_cobjects,libreofficekitgtk,\
libreofficekit/source/gtk/lokdocview \ libreofficekit/source/gtk/lokdocview \
)) ))
......
...@@ -11,10 +11,6 @@ $(eval $(call gb_Module_Module,libreofficekit)) ...@@ -11,10 +11,6 @@ $(eval $(call gb_Module_Module,libreofficekit))
ifeq ($(OS),LINUX) ifeq ($(OS),LINUX)
$(eval $(call gb_Module_add_targets,libreofficekit,\
StaticLibrary_libreofficekit \
))
# $(eval $(call gb_Module_add_check_targets,libreofficekit,\ # $(eval $(call gb_Module_add_check_targets,libreofficekit,\
# CppunitTest_libreofficekit_tiledrendering \ # CppunitTest_libreofficekit_tiledrendering \
# )) # ))
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_StaticLibrary_StaticLibrary,libreofficekit))
$(eval $(call gb_StaticLibrary_add_cobjects,libreofficekit,\
libreofficekit/source/shim \
))
# vim: set noet sw=4 ts=4:
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <LibreOfficeKit/LibreOfficeKitGtk.h> #include <LibreOfficeKit/LibreOfficeKitGtk.h>
#include <LibreOfficeKit/LibreOfficeKitInit.h>
#include "../lokdocview_quad/lokdocview_quad.h" #include "../lokdocview_quad/lokdocview_quad.h"
static int help() static int help()
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <vcl/pngwrite.hxx> #include <vcl/pngwrite.hxx>
#define LOK_USE_UNSTABLE_API #define LOK_USE_UNSTABLE_API
#include <LibreOfficeKit/LibreOfficeKitInit.h>
#include <LibreOfficeKit/LibreOfficeKit.hxx> #include <LibreOfficeKit/LibreOfficeKit.hxx>
using namespace ::boost; using namespace ::boost;
......
...@@ -17,10 +17,6 @@ $(eval $(call gb_Executable_use_libraries,libtest,\ ...@@ -17,10 +17,6 @@ $(eval $(call gb_Executable_use_libraries,libtest,\
$(gb_UWINAPI) \ $(gb_UWINAPI) \
)) ))
$(eval $(call gb_Executable_use_static_libraries,libtest,\
libreofficekit \
))
$(eval $(call gb_Executable_add_libs,libtest,\ $(eval $(call gb_Executable_add_libs,libtest,\
-ldl \ -ldl \
-pthread \ -pthread \
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <math.h> #include <math.h>
#include <sys/time.h> #include <sys/time.h>
#include <sal/types.h> #include <sal/types.h>
#include <LibreOfficeKit/LibreOfficeKitInit.h>
#include <LibreOfficeKit/LibreOfficeKit.hxx> #include <LibreOfficeKit/LibreOfficeKit.hxx>
using namespace ::lok; using namespace ::lok;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment