On Fri, Apr 12, 2013 at 05:20:48PM -0500, Henry Tiquet Leyva wrote: > http://ooo.pastebin.ca/2357487 > > I am sorry, here is it, I think it is better like this.
at first sight, there is nothing wrong (though the code is old). How are you building this code? It tries to connect to a running office listening on port 2083, is the office running and listening? > >> > I have done all you told me but I have the error yet. > >> > I searched in Internet and it said that generally such errors are > >> caused by > >> > addressing non-existent/allocated memory. when working with css::uno::Reference, you may get a segmentation fault with the dereference operator, if you don't check first with BaseReference::is(), but your code does the check, and according to your previous mail, it prints "XComponentloader successfully instanciated\n". Wild guessing, I assume your program is not bootstrapping the remote counterpart, thus the reference to the desktop is invalid. In order to know where your program is crashing, build with debug symbols, run it inside the debugger, and after crash look at the backtrace. Alternatively try with the attached code, it has an SDK Makefile, you need to set the SDK environment in order to build it; and it uses the simple bootstrap mechanism, so you get rid of bootstrapping an office listening on a port. To build it and run: source <path to>/setsdkenv_unix.sh make DEBUG=yes PRJ=$OO_SDK_HOME HelloDraw.run Regards -- Ariel Constenla-Haile La Plata, Argentina
#************************************************************** # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # #************************************************************** # On *nix can be overridden with # make PRJ=$OO_SDK_HOME PRJ=../../../.. SETTINGS=$(PRJ)/settings include $(SETTINGS)/settings.mk include $(SETTINGS)/std.mk include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings APP_NAME=HelloDraw MAINTARGET=$(APP_NAME)_Example #this should be in odk/settings/std.mk OUT_DEPLOY=$(OUT)/deploy OUT_APP_INC=$(OUT_INC)/$(APP_NAME) OUT_APP_GEN=$(OUT_MISC)/$(APP_NAME) OUT_APP_OBJ=$(OUT_OBJ)/$(APP_NAME) OUT_APP_LIB=$(SHAREDLIB_OUT)/$(APP_NAME) OUT_APP_BIN=$(OUT_BIN)/$(APP_NAME) OUT_APP_DEPLOY=$(OUT_DEPLOY)/$(APP_NAME) CXXFILES = main.cxx OBJFILES = $(patsubst %.cxx,$(OUT_APP_OBJ)/%.$(OBJ_EXT),$(CXXFILES)) ifneq "$(DEBUG)" "" CC_DEFINES+=-DOSL_DEBUG_LEVEL=3 endif # Targets .PHONY: ALL ALL : \ $(MAINTARGET) include $(SETTINGS)/stdtarget.mk $(OUT_APP_OBJ)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) -$(MKDIR) $(subst /,$(PS),$(@D)) $(CC) $(CC_FLAGS) $(STL_INCLUDES) $(CC_INCLUDES) -I$(OUT_APP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< $(OUT_APP_BIN)/_$(APP_NAME)$(EXE_EXT) : $(OBJFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) -$(MKDIR) $(subst /,$(PS),$(OUT_APP_GEN)) ifeq "$(OS)" "WIN" $(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(OUT_APP_GEN)/$(basename $(@F)).map \ $(OBJFILES) $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) else $(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $(OBJFILES) \ $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALHELPERDYLIB) $(SALDYLIB) ifeq "$(OS)" "MACOSX" $(INSTALL_NAME_URELIBS_BIN) $@ endif endif $(OUT_APP_BIN)/$(APP_NAME)$(EXE_EXT) : $(OUT_APP_BIN)/_$(APP_NAME)$(EXE_EXT) -$(MKDIR) $(subst /,$(PS),$(@D)) $(COPY) $(subst /,$(PS),$(BIN_DIR)/unoapploader$(EXE_EXT)) $(subst /,$(PS),$@) # workaround for touch problem under Windows with full qualified paths make -t $@ $(OUT_APP_BIN)/$(TEST_DOC) : $(TEST_DOC) -$(MKDIR) $(subst /,$(PS),$(@D)) $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$@) $(MAINTARGET) : $(OUT_APP_BIN)/$(APP_NAME)$(EXE_EXT) @echo -------------------------------------------------------------------------------- @echo Please use the following command to execute the example! @echo - @echo $(MAKE) $(APP_NAME).run @echo -------------------------------------------------------------------------------- $(APP_NAME).run: $(OUT_APP_BIN)/$(APP_NAME)$(EXE_EXT) $(OUT_APP_BIN)/$(TEST_DOC) cd $(subst /,$(PS),$(OUT_APP_BIN)) && $(basename $@) .PHONY: clean clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_INC)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_GEN)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_OBJ)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_LIB)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_BIN)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_DEPLOY))
/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ #include <cppuhelper/bootstrap.hxx> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <iostream> namespace css = ::com::sun::star; using rtl::OUString; int main( void ) { try { css::uno::Reference< css::uno::XComponentContext > xContext( cppu::bootstrap() ); css::uno::Reference< css::frame::XComponentLoader > xLoader( xContext->getServiceManager()->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ), xContext ), css::uno::UNO_QUERY_THROW ); css::uno::Reference < css::drawing::XDrawPagesSupplier > xDoc( xLoader->loadComponentFromURL( OUString( RTL_CONSTASCII_USTRINGPARAM( "private:factory/sdraw" ) ), OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" ) ), css::frame::FrameSearchFlag::ALL, css::uno::Sequence < css::beans::PropertyValue >() ), css::uno::UNO_QUERY_THROW ); } catch ( const css::uno::Exception &e ) { std::cerr << "Caught an exception: " << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << '\n'; } return 0; }
pgpwcidUaKbir.pgp
Description: PGP signature