Skip to content

Provide def file for windows import lib #15

Closed
@Pospelove

Description

@Pospelove

required for microsoft/vcpkg#29743

this can be done during sync-headers processing
https://github.com/nodejs/node-api-headers/blob/main/.github/workflows/sync-headers.yml

the following code may be used to generate .def file

// https://github.com/cmake-js/cmake-js/blob/e2452ee226490bc666d286ab0860aeb35fbbb035/lib/cMake.js#L293

const headers = require('.');

// Compile a Set of all the symbols that could be exported
const allSymbols = new Set()
for (const ver of Object.values(headers.symbols)) {
    for (const sym of ver.node_api_symbols) {
        allSymbols.add(sym)
    }
    for (const sym of ver.js_native_api_symbols) {
        allSymbols.add(sym)
    }
}

// Write a 'def' file for NODE.EXE
const allSymbolsArr = Array.from(allSymbols)
require('fs').writeFileSync("./node.def", 'NAME NODE.EXE\nEXPORTS\n' + allSymbolsArr.join('\n'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions