Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8322033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:14:13+00:00 2026-06-08T23:14:13+00:00

I have some C++ code for a node.js module that is written for node

  • 0

I have some C++ code for a node.js module that is written for node 0.8 and its enhanced libuv. Specifically I am using the uv_mutex_* functions, which don’t exist in the libuv included in node 0.6. I want to conditionally embed pthreads equivalents of these functions, but only when built on the old version.

This should give me a cross-platform build (Windows and Linux) when built on node 0.8 and a functioning Linux version if the node version is 0.6.

Is there a preprocessor #define for the node version? I can’t find one. The best I can come up with is to do some kludgy stuff in binding.gyp to try to guess the version based on <@(node_root) and somehow massage that into a ‘defines’ value. There must be a better way!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:14:15+00:00Added an answer on June 8, 2026 at 11:14 pm

    The binding.gyp file of the Memwatch module does what you’re looking for.

    It defines a variable to capture the node version:

    'variables': {
      'node_ver': '<!(node --version | sed -e "s/^v\([0-9]*\\.[0-9]*\).*$/\\1/")'
    },
    

    And then use it in a condition:

    'target_conditions': [
      ['node_ver=="0.8"', { 'defines': ['NEW_COMPACTION_BEHAVIOR'] } ]
    ]
    

    Not the most elegant solution, but apparently, there’s nothing better right now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just written some code, which as i was writing i thought, this
I have some code which returns InnerXML for a XMLNode. The node can contain
Scenario I have a Node.JS service (written using ExpressJS ) that accepts image uploads
I'm trying to write a Node.js module, using C++, that wraps and exposes some
I have some code that will change the background color of a specific label
I have some code here that uses bitsets to store many 1 bit values
I have some code that is supposed to return an NSString. Instead it is
I have some code that generates Visio masters for me, and some masters have
I have some code that causes the box2d physics simulation to stutter forever after
I have some code which takes strings representing hexadecimal numbers - hex colors, actually

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.