diff options
author | Joachim Lingner <jl@openoffice.org> | 2001-04-19 14:26:32 +0000 |
---|---|---|
committer | Joachim Lingner <jl@openoffice.org> | 2001-04-19 14:26:32 +0000 |
commit | bc6a2cdcb6ee466aaebc428a58eed93803f7016d (patch) | |
tree | a0c1156b67c44f9b105a4e52b4ec04c5c9a51cc6 /salhelper/test/dynamicloader | |
parent | 4b5e61c518f1159ddc2d3852f97b6726a1c0bd7e (diff) |
new
Diffstat (limited to 'salhelper/test/dynamicloader')
-rw-r--r-- | salhelper/test/dynamicloader/loader.cxx | 37 | ||||
-rw-r--r-- | salhelper/test/dynamicloader/makefile.mk | 165 | ||||
-rw-r--r-- | salhelper/test/dynamicloader/samplelib.cxx | 37 |
3 files changed, 239 insertions, 0 deletions
diff --git a/salhelper/test/dynamicloader/loader.cxx b/salhelper/test/dynamicloader/loader.cxx new file mode 100644 index 000000000000..82adeecaea9e --- /dev/null +++ b/salhelper/test/dynamicloader/loader.cxx @@ -0,0 +1,37 @@ + +#include <salhelper/dynload.hxx> +#include <rtl/ustring> +#include <stdio.h> +#include "samplelib.hxx" + + +using namespace salhelper; +using namespace rtl; + + +class SampleLibLoader + : public ::salhelper::ODynamicLoader<SampleLib_Api> +{ +public: + SampleLibLoader(): + ::salhelper::ODynamicLoader<SampleLib_Api> + (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SAL_MODULENAME( "samplelib") ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(SAMPLELIB_INIT_FUNCTION_NAME) )) + {} + +}; + + +int main( int argc, char *argv[ ], char *envp[ ] ) +{ + SampleLibLoader Loader; + SampleLibLoader Loader2; + Loader= Loader2; + SampleLib_Api *pApi= Loader.getApi(); + + sal_Int32 retint= pApi->funcA( 10); + double retdouble= pApi->funcB( 3.14); + + + return 0; +} diff --git a/salhelper/test/dynamicloader/makefile.mk b/salhelper/test/dynamicloader/makefile.mk new file mode 100644 index 000000000000..da5a5c731576 --- /dev/null +++ b/salhelper/test/dynamicloader/makefile.mk @@ -0,0 +1,165 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1 $ +# +# last change: $Author: jl $ $Date: 2001-04-19 15:26:23 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/ + +PRJNAME=salhelper +TARGET=dynloader +TARGET1=samplelib +TARGETTYPE=CUI +LIBTARGET=NO + +NO_BSYMBOLIC= TRUE +ENABLE_EXCEPTIONS=TRUE +BOOTSTRAP_SERVICE=FALSE + +# --- Settings --- + +.INCLUDE : settings.mk + +# --- Files --- + +UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb +UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb + +.IF "$(BOOTSTRAP_SERVICE)" == "TRUE" +UNOUCROUT= $(OUT)$/inc$/comprehensive +INCPRE+= $(OUT)$/inc$/comprehensive +CPPUMAKERFLAGS += -C +.ELSE +UNOUCROUT= $(OUT)$/inc +.ENDIF + +#RTTI on +.IF "$(OS)" == "WNT" +CFLAGS+= -GR +.ENDIF + + +# UNOTYPES= com.sun.star.lang.XInitialization \ +#--------------------------------------------------------------------------- +# Build the test library which is loaded by the +# RealDynamicLoader + +SLOFILES= \ + $(SLO)$/samplelib.obj + +LIB1TARGET=$(SLB)$/$(TARGET1).lib +LIB1OBJFILES= \ + $(SLO)$/samplelib.obj + + +SHL1TARGET= $(TARGET1) + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(TARGET1) +SHL1LIBS= $(SLB)$/$(TARGET1).lib +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEFLIB1NAME =$(TARGET1) +DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt + +#DEF1EXPORTFILE= exports.dxp + +# ------------------------------------------------------------------------------ + +APP1NOSAL=TRUE + +APP1TARGET= $(TARGET) + +APP1OBJS= $(OBJ)$/loader.obj + +#LIBCIMT=msvcrtd.lib + + +APP1STDLIBS= \ + $(SALLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) + +APP1LIBS= $(LB)$/isalhelper.lib + + + +.IF "$(GUI)"=="WNT" +APP1STDLIBS += $(LIBCIMT) +.ENDIF + +APP1DEF= $(MISC)\$(APP1TARGET).def + +# --- Targets --- + +.INCLUDE : target.mk + + +$(MISC)$/$(SHL1TARGET).flt: makefile.mk + @echo ------------------------------ + @echo Making: $@ + @echo __CT>>$@ + + diff --git a/salhelper/test/dynamicloader/samplelib.cxx b/salhelper/test/dynamicloader/samplelib.cxx new file mode 100644 index 000000000000..f4809f51fd2e --- /dev/null +++ b/salhelper/test/dynamicloader/samplelib.cxx @@ -0,0 +1,37 @@ +#include "samplelib.hxx" +#include <sal/types.h> +/* + + +*/ + +extern "C" +SampleLib_Api* SAL_CALL initSampleLibApi(void) +{ + static SampleLib_Api aApi= {0,0}; + if (!aApi.funcA) + { + aApi.funcA= &funcA; + aApi.funcB= &funcB; + return (&aApi); + } + else + { + return (&aApi); + } + +} + + +sal_Int32 SAL_CALL funcA( sal_Int32 a) +{ + return a; +} + + +double SAL_CALL funcB( double a) +{ + return a; +} + + |