Coder Social home page Coder Social logo

napi-go's People

Contributors

akshayganeshen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

napi-go's Issues

Module did not self-register

hello:
I compiled on windows 10 ,node v16.17.1 reported: Module did not self-register.But on mac and linux version works well,help pls!

how can i use js callback

i want to use like this:
js code:
let gomodule=require("./gomod.node");
gomodule.func(
function( fromGoObj){
console.info(fromGoObj)
}
);

then how can i write go code?

Your project has been very helpful to me. Thank you very much

Error Unknown file extension ".node" when running test js file

I was able to build successfully and then created a js file to run but when I do run it gives the error. I run with node test.mjs. My two go files are like this:

package handlers

import (
	"github.com/akshayganeshen/napi-go/js"
)

func MyHandler(env js.Env, this js.Value, args []js.Value) any {
	return "hello"
}
package main

import (
	"keyring/internal/handlers"

	"github.com/akshayganeshen/napi-go/entry"

	"github.com/akshayganeshen/napi-go/js"
)

func init() {
	entry.Export("myHandler", js.AsCallback(handlers.MyHandler))
}

func main() {}

Error building cgo: cannot parse $WORK/b046/_cgo_.o as ELF, Mach-O, PE or XCOFF

Info
Macbook Pro M3Pro (2024)
Sonoma 14.4.1
Node: v21.7.3
Go: 1.22.2

I have added the example files, but when I try to build the go to create "example.node", I get this error:
github.com/akshayganeshen/napi-go: invalid flag in #cgo LDFLAGS: -Wl,-no_pie

I am new to go so I'm not quite sure how to fix this, any help would be greatly appreciated!

I've uploaded what I have to this repo:

https://github.com/annie-elequin/napi-go-test

Error building: undefined: NapiGoAsyncWorkID and undefined: Status

I'm on an m1 mac and running below command when this error occurs.

CGO_LDFLAGS_ALLOW=-Wl,-no_pie GOOS=darwin GOARCH=arm64 go build -buildmode=c-shared -o "example.node" -a ./cmd

# github.com/akshayganeshen/napi-go
../../../../go/pkg/mod/github.com/akshayganeshen/[email protected]/async_work.go:9:9: undefined: NapiGoAsyncWorkID
../../../../go/pkg/mod/github.com/akshayganeshen/[email protected]/async_work.go:14:49: undefined: Status

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.