[Ace-users] [ace-users] question about runtime configuration with the ACELogging Strategy

richard zhao rich4tech at yahoo.com
Fri Dec 7 14:36:12 CST 2007


Hi Steve,
   
  I read through C++NPv2 chapter5 and add several micros into my code:
   
  ACE_FACTORY_DEFINE(ACE_Local_Service, Logger
  ACE_STATIC_SVC_DEFINE(
                                            Logger_Descriptor,
                                            ACE_TEXT("Logger"),
                                            ACE_SVC_OBJ_T,
                                            &ACE_SVC_NAME(Logger),
                                            ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
                                            0)
  ACE_STATIC_SVC_REQUIRE(Logger_Descriptor)
   
  all of the above micros are in file scope.
   
  before call open(...), I add 
  ACE_STATIC_SVC_REGISTER(Logger_Descriptor)
  this micro is within class scope
   
  when I build my static lib, I set 
  enable-static=yes
  enable-shared=no
  enable-lib-all=yes
  enable-lib-logging=yes
  enable-logging=yes.
   
  when I compile my application, the following errors appear in order:
  In function 'ACE_Service_Object * _make_Logger(..)
  error: expected type-specifier before 'Logger'
  error: cannot convert 'int *' to 'ACE_Service_Object *' in return 
  error: expected ';'before 'Logger'
  error: 'Logger' was not declared in this scope
   
   
  It looks like I did not add Logger into the lib, I took a look at the configure file and no parameter is related to Logger directly.
   
  could you give me more information about it.
  thank you very much.
   
  Richard
   
  

Steve Huston <shuston at riverace.com> wrote:
      Hi Richard,
   
  Right... the Logger stuff is built into ACE when you build it as a shared library. When you build static, dynamic services inside of ACE (like Logger) won't be available. You may be able to add the static service information and allow the logging service to work as a static service when ACE is built as a static library.
   
  C++NPv2 chapter 5 describes dynamic and static services. If you need further expertise with this project, please contact me to discuss it further.
   
  Thanks,
  -Steve
  --
Steve Huston, Riverace Corporation
Want to take ACE training on YOUR schedule?
See http://www.riverace.com/training.htm

    
  -----Original Message-----
From: richard zhao [mailto:rich4tech at yahoo.com] 
Sent: Friday, December 07, 2007 11:19 AM
To: Steve Huston; ace-users at cs.wustl.edu
Subject: RE: [ace-users] question about runtime configuration with the ACELogging Strategy


  Hello, Steve,
   
  thank you for your response.
  in the application by using shared ACE lib. I did not write any code and did not define any class called Logger. I just put Logger after dynamic. do you think i need to write a class called Logger when I use static ACE lib.
   
  thanks
  Richard

Steve Huston <shuston at riverace.com> wrote:
      Hi Richard,
   
  Thanks for the PROBLEM-REPORT-FORM. I suspect you'll need to add the static service macros to ACE to set up the static service loading info. Please see C++NPv2 chapter 5 for details.
   
  Best regards,
  -Steve
  --
Steve Huston, Riverace Corporation
Want to take ACE training on YOUR schedule?
See http://www.riverace.com/training.htm

    
  -----Original Message-----
From: ace-users-bounces at cse.wustl.edu [mailto:ace-users-bounces at cse.wustl.edu] On Behalf Of richard zhao
Sent: Thursday, December 06, 2007 5:33 PM
To: ace-users at cs.wustl.edu
Subject: [ace-users] question about runtime configuration with the ACELogging Strategy


  ACE VERSION: 5.6.1
  HOST MACHINE and OPERATING SYSTEM:  Intel PC, Linux enterprise 5.0
  TARGET MACHINE and OPERATING SYSTEM: Same
  COMPILER NAME AND VERSION (AND PATCHLEVEL):
G++

  I am writing a application by using ACE lib.
I wrote a log application by using runtime configuration with the ACE logging strategy,
  the input configuration file is like the following.
   
  dynamic Logger Service_Object * ACE:_make_ACE_Logging_Strategy() "-s log.out -f STDERR|OSTREAM - INFO"
   
  in the application file , I use the code segment:
  if (ACE_Service_Config::open(argc,
                                              argv,
                                              ACE_DEFAULT_LOGGER_KEY,
                                               1,
                                               0,
                                                1) < 0)
  {
  }
  by this way, if I compile and link ACE to shared lib, it works well, I can create log.out and all message output to this log file.
   
  however, if I compile and link ACE to static lib, this way does not work, the log.out can not create. the error message is like the following:
  1 ACE(28532|2142880) LN::open_dll_ failed to open ACE. error: check log for detail.
  2. ACE(28532|2142880) unable to create service object for logger.
   
  I guess it is because no shared lib so I change the configuration file to the following.
   
  static Logger "-s log.out -f STDERR|OSTREAM -p INFO"
   
  then recompile and link my application which are using static ACE lib
  the log.out still can not be created. 
  error mesasge is :
  SG::initialize-service Logger was not located.
  even I change the fourth parameter of open to 0.
   
  could someboby tell me some solutions of how to solve this problem. that is by using static ACE lib to create log application.
  thanks in advance.
   
  Richard
   
    
---------------------------------
  Never miss a thing. Make Yahoo your homepage. 

    
---------------------------------
  Never miss a thing. Make Yahoo your homepage. 

       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/ace-users/attachments/20071207/0381de0e/attachment-0001.html 


More information about the Ace-users mailing list