nodejs / nodejs/node-gyp

Enable CLRSupport and add a reference to the DLL

Open
#2,875 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.7k
Forks
1.9k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

Hi,

I am looking to enable CLRSupport properly and add a reference to the DLL. I didn't find how to do it, my file look like this actually:

Current code not working
{
  "targets": [
    {
      "target_name": "addon_cpp",
      "conditions": [
        ["OS==\"win\"", {
          "msbuild_settings": {
            "ClCompile": {
              #"RuntimeLibrary":"MultiThreadedDebugDLL"
              "BasicRuntimeChecks": "Default",
              "ExceptionHandling": "Async",
              #"AdditionalOptions": [
              # "/CLR",
              #],
              #"ForcedUsingFiles": [
              #  "C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\mscorlib.dll"
              #],
              #"AdditionalUsingDirectories": [
              #  "C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\"
              #]
            }
          },
        }]
      ],
      "sources": [
        "<(module_root_dir)/src/addon.cc"
      ]
    }
  ]
}
1. CLRSSuport

I would like to change the value of this property: Conf Properties > Advanced > CLRS: /clr
image

In the .vcxproj, this look like this:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    #...
  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <CLRSupport>true</CLRSupport>
  </PropertyGroup>
  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <CLRSupport>true</CLRSupport>
  </PropertyGroup>
2. Add reference to a .dll:

In VS, I do like that:

image

In the .vcxprojet, this look like this:

  <ItemGroup>
    <Reference Include="MICROMODULE_USB2">
      <HintPath>..\DLL\MICROMODULE_USB2.dll</HintPath>
    </Reference>
  </ItemGroup>

I didn't find which key, I need to use in the binding.gyp

(I already try to use MSVSSettings.py and see this #2116 but without success).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with gyp/pylib/gyp/MSVSSettings.py and the binding.gyp configuration shown in the report; inspect how node-gyp generates the Windows .vcxproj for the addon_cpp target. Define how CLRSupport and DLL references should be represented, then verify that the generated project builds src/addon.cc with those settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.