Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Conditional compiling for 32/64 bits

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Conditional compiling for 32/64 bits

    Dear experts!
    I can see from different posts that preprocessor directives can be used in NT8 indicators. Is it possible to make conditional compiling depending of 32/64 bits platform?
    Something similar to the below part of the code:
    Code:
    [StructLayout(LayoutKind.Explicit,Size = 12)]
    	public struct My Data
    		{
    		 FieldOffset(0)]	public	int			iCode;		 		
    		 FieldOffset(4)]	public	IntPtr			szName;
    	#if NT8_32 									
    		 FieldOffset(8)]	public	int			iReserved;
    	#endif
    		}
    If answer is “yes”, what could be the directive in #if statement. If answer is "no" any suggestion about the ways to achieve similar result

    Thank you in advance
    GmA

    #2
    Hello gma17,

    Thanks for opening the thread.

    There are not any supported preprocessor directives that I know of that can identify a 64bit compile from a 32bit compile.

    I could submit a feature request on your behalf to request to have supported preprocessor directives for 32 bit and 64 bit compiles if it interests you.

    If that is the case, please let me know.
    JimNinjaTrader Customer Service

    Comment


      #3
      Helo Jim!

      Thank you for the fast reply.
      Well, It could be a good feature in the future, but I'll need to find another solution.

      With kind regards
      GmA

      Comment


        #4
        Hello gma17,

        As a thought, you could place this in a separate namespace and include that namespace depending on the version of the script you are working on. This wouldn't be as 'seamless' as having the code indeffed, but it could lead you in a way where you can cleanly separate code from different versions of the script.

        Our colleague Chelsea has posted an example of how an AddOn can be used for general use methods and variables.

        Chelsea's example for NT8 - http://ninjatrader.com/support/forum...104#post457104
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by michi08, 10-05-2018, 09:31 AM
        3 responses
        740 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by sightcareclickhere, Today, 01:55 PM
        0 responses
        1 view
        0 likes
        Last Post sightcareclickhere  
        Started by Mindset, 05-06-2023, 09:03 PM
        9 responses
        258 views
        0 likes
        Last Post ender_wiggum  
        Started by Mizzouman1, Today, 07:35 AM
        4 responses
        18 views
        0 likes
        Last Post Mizzouman1  
        Started by philmg, Today, 01:17 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Working...
        X