(OK) cBPM(段错误(吐核))—((EndWorkflowEvent*)evt)->getProcessID()—getenv 返NULL


 

★★★★★上面的问题——解决了

--------> /opt/cBPM/criteria-lin/src/Criteria/Criteria.WorkflowEngine/events/WorkflowListener.cpp

注释掉两行:(取消注释,会出现上面问题,有待解决)

 

    else if ( evt->getName() == "EndWorkflowEvent" )

{

        CM_TRACE_CODEPATH( "Event Received:[EndWorkflowEvent]")

        //processID = ((EndWorkflowEvent*)evt)->getProcessID();

        //sEvent = "COMPLETED";

}

 



+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

http://forums.codeblocks.org/index.php?topic=10575.5;wap2

★★★★★ ( getenv  返回值为 NULL )


--------> /opt/cBPM/criteria-lin/src/Criteria/Criteria.WorkflowEngine/engine/Workflow.cpp

CM_TRACE_CODEPATH( "Deleting TaskAction Object.")

delete taskAction; 设置断点

 

 

--------> /opt/cBPM/criteria-lin/src/Criteria/Criteria.WorkflowEngine/events/WorkflowListener.cpp

        processID = ((EndWorkflowEvent*)evt)->getProcessID(); 设置断点

调用

--------> /opt/cBPM/criteria-lin/src/Criteria/Criteria.WorkflowEngine/events/BaseWorkflowEvent.cpp

    return _WF->getProcess()->getProcessId();  设置断点

调用

--------> /opt/cBPM/criteria-lin/src/Criteria/Criteria.WorkflowEngine/engine/Workflow.cpp

WorkflowProcesses::WorkflowProcess* Workflow::getProcess() 设置断点

{

    return process;

}

--------> /opt/cBPM/criteria-lin/include/WorkflowEngine/Workflow.h

WorkflowProcesses::WorkflowProcess*    process;

 

★★★★★上面的问题——终于解决了( getenv  返回值为 NULL )Program works from commandline, but not from codeblocks

http://forums.codeblocks.org/index.php?topic=10575.5;wap2

 

 

resander
I inserted the following three calls at the start of connectSrv routine (see a previous post on this thread):

char * odbcini = getenv ( "ODBCINI" ) ;
char * oraclehome = getenv ( "ORACLE_HOME" ) ;
char * ldlibrarypath = getenv ( "LD_LIBRARY_PATH" ) ;
 
char * getenv (const char *name)
returns a string that is the value of the environment variable name. 
If the environment variable name is not defined, the value is a null pointer. 


Starting codeblocks from Application menu

The odbcini and oraclehome variables are NULL after the getenv calls. This means they are not available for my program, which fails finding the ODBC driver and other library dependencies. The ldlibrarypath variable is .:, which is wrong.

Starting codeblocks from my HOME /home/ken and commandline as /usr/bin/codeblocks
Works.

Wikipedia says this about environment:

'In all Unix and Unix-like systems, each process has its own private set of environment variables. By default, when a process is created it inherits a duplicate environment of its parent process, except for explicit changes made by the parent when it creates the child. At API level, these changes must be done between fork and exec.'

When I start codeblocks from the commandline my environment is inherited by codeblocks. Then if codeblocks starts my-prog by exec/fork the environment would be passed on again, which is what my-prog needs.

There is a predefined program variable extern char ** environ; which is an array of property strings in the environment. When starting codeblocks from the Application menu I put these to the screen with printf and could see the environment was different from mine. 

- there are fewer properties, especially the important ODBCINI, 
  ORACLE_HOME are missing

- LD_LIBRARY_PATH is .: which is different from my ldlibpath

- PWD is set to /home/ken/Projects/lsken2      my PWD is /home/ken

- HOME is /home/ken for both (can be used to chdir $HOME before starting
  codeblocks from menu)

 

 

-------------------------

 

-------------------------

 

++++++++++++++++++++++++++++++++++++++++++++++++++



resander:
I inserted the following three calls at the start of connectSrv routine (see a previous post on this thread):

char * odbcini = getenv ( "ODBCINI" ) ;
char * oraclehome = getenv ( "ORACLE_HOME" ) ;
char * ldlibrarypath = getenv ( "LD_LIBRARY_PATH" ) ;
 
char * getenv (const char *name)
returns a string that is the value of the environment variable name.
If the environment variable name is not defined, the value is a null pointer.


Starting codeblocks from Application menu

The odbcini and oraclehome variables are NULL after the getenv calls. This means they are not available for my program, which fails finding the ODBC driver and other library dependencies. The ldlibrarypath variable is .:, which is wrong.


Starting codeblocks from my HOME /home/ken and commandline as /usr/bin/codeblocks

Works.


Wikipedia says this about environment:

'In all Unix and Unix-like systems, each process has its own private set of environment variables. By default, when a process is created it inherits a duplicate environment of its parent process, except for explicit changes made by the parent when it creates the child. At API level, these changes must be done between fork and exec.'

When I start codeblocks from the commandline my environment is inherited by codeblocks. Then if codeblocks starts my-prog by exec/fork the environment would be passed on again, which is what my-prog needs.

There is a predefined program variable extern char ** environ; which is an array of property strings in the environment. When starting codeblocks from the Application menu I put these to the screen with printf and could see the environment was different from mine.

- there are fewer properties, especially the important ODBCINI,
  ORACLE_HOME are missing

- LD_LIBRARY_PATH is .: which is different from my ldlibpath

- PWD is set to /home/ken/Projects/lsken2      my PWD is /home/ken

- HOME is /home/ken for both (can be used to chdir $HOME before starting
  codeblocks from menu)
posted @   张同光  阅读(108)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示