none
CRT not initialized in release mode

    Frage

  • hi everyone,

    I built a dll from other program and call in VC++. In the debug mode, it works very well. However in the release mode some error occored:
    ******************************
    Runtime Error
    ..............
    R6030
    CRT not initilized.
    ******************************

    and when I change the runtime library to Multi-threaded, it can works. but due to the whole project, it should work in Multi-threaded DLL.

    I dont have a good background about VS.

    How should I fix it?

    any comments and assistances are appriciated.

    ps. I also tried to initialized very global variables, but same error occured.

    #include <iostream>
    #include <stdlib.h>
    #include <BTinit.h>
    #include <BTloop.h>
    #include <BTend.h>
    
    ///variables for the bluetooth connection
    
    static int32_t timeout = 10000;
    TD1 error;
    LVRefNum  con_ID;
    LVBoolean btDis , serDis;
    char macAdd[]="00:06:66:00:3a:64";
    double in_Vol = 4.99, out_Vol=0;
    
    
    void main()
    {	
    	printf("first print\n");
    Bluetooth_initialization(macAdd,timeout,&error,&con_ID,
    &serDis,&btDis);
    	if(!btDis)
    	{
    
    		printf("did not find bluetooth devices\n");
    		
    		
    	}
    	else if(!serDis)
    	{
    		printf("service is not available\n");
    		
    	}
    	else
    	{
    		printf("second print\n");
    		int i = 0;
    		
    		for (;i<15;i++)
    		{
    			Bluetooth_loop(in_Vol,timeout,
    &error,&con_ID,&out_Vol,&error,&con_ID);
    			printf("voltage%f    ",out_Vol);
    			double n = -5.9856*out_Vol+25.271;
    			printf("force%f\n",n);
    			
    		}
    		Bluetooth_ending(&con_ID,timeout,&error);
    		printf("forth print\n");
    		
    	}
    
    	getchar();
    
    	
    }

     

    Dienstag, 29. November 2011 03:55

Antworten

  • Hi Sample,

    If we develop and use DLL both in Visual Studio, we should keep the same mode of compiling. This is the meaning of the third paragraph in my last reply.

    In your case, the DLL was developed with LabVIEW. Perhaps this issue has something with the mixing of the third-party product and Visual Studio. I suggest you try dependency walker to find out the version of the CRT your LabVIEW uses.

    Best regards,

    Helen


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us
    • Als Antwort markiert Helen Zhao Dienstag, 6. Dezember 2011 07:02
    Freitag, 2. Dezember 2011 02:40

Alle Antworten

  • Some questions:

    Did you wind up mixing some modules built with one crt and some with another?  like some static and some dll or some debug and some release?

    What runtime is your bluetooth library built with?

    What runtime is your console app built with?

    Did you do any "exclude libraries"?

    Did you write your Bluetooth library?  

    Do you load any libraries or create any threads in there?

    Did you do any work in your DllMain?

    Dienstag, 29. November 2011 04:32
  • Hi,

    please check the below link and make sure that all settings are correct.

    http://msdn.microsoft.com/en-us/library/9ecfyw6c(v=vs.80).aspx

    There is equivalent win32 api function for CRT functions. http://support.microsoft.com/kb/99456

    if we are sure that not using any CRT function we can remove the dependency.

     

    Thanks,

    Bhash

     

     

    Dienstag, 29. November 2011 17:56
  • Hi Sample Li,
     
    Thanks for your participation in the MSDN Forum.
     
    As far as I know, a Visual Studio 2010 project has separate configurations for release and debug versions of your program. The general idea is that the debug build is used for internal testing and finding user reported problems since extra information is included. The release build is used by the end users because it has gone through optimizations and generally runs better.
     
    I recommend that we don't mix Release mode and Debug mode.  At the Debug mode of the application, use the DLLs of Debug version. While at the Release mode, use the DLLs of Release version.  So please try to make sure that the mode of the application is same as that of your DLL. You can change the mode in Solution Configurations in Visual Studio.

    After setting the configuration properly, please rebuild the solution and run the application.
     
    I hope this reply is helpful to you. If you have any other problems, please feel free to let me know.
    Best regards,


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us
    Mittwoch, 30. November 2011 08:45
  • Hi Helen,

    thanks for reply.

    In your third paragraph, whether it means: I would use the same mode with the one used when I built the dll?

    this DLL is built with LabVIEW, I checked the setting when I built it, I did not see anything about the release or debug mode setting.

    And from some other's reply, without any changing about the DLL and code, it worked on his machine.

    So my conclusion is that, maybe there are some setting is not suitable for the VS. 

    what is that potential problem in your opinion?

    Sample

    Donnerstag, 1. Dezember 2011 03:24
  • Hi Sample,

    If we develop and use DLL both in Visual Studio, we should keep the same mode of compiling. This is the meaning of the third paragraph in my last reply.

    In your case, the DLL was developed with LabVIEW. Perhaps this issue has something with the mixing of the third-party product and Visual Studio. I suggest you try dependency walker to find out the version of the CRT your LabVIEW uses.

    Best regards,

    Helen


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us
    • Als Antwort markiert Helen Zhao Dienstag, 6. Dezember 2011 07:02
    Freitag, 2. Dezember 2011 02:40
  • Hi Sample,

    I'd like to mark my reply as answer. If you have any questions, you can post back and unmark them. We'll continue working with you on this issue.

    Best regards,
    Helen


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us
    Dienstag, 6. Dezember 2011 07:00