Xutaotaotao / electron-prokit

🚀 Use electron like a pro!

Home Page:https://xutaotaotao.github.io/electron-prokit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

源码在windows下运行报错"Failed to load shared library: %1 不是有效的 Win32 应用程序。"

qian-kong opened this issue · comments

electron-prokit源码本地windows系统下执行npm run dev

Environment

  • Node Version: 20.7.0
  • OS: Windows 11

Reproduction

Steps to reproduce

1、执行 npm run dev

What is Expected?

运行成功

What is actually happening?

提示错误 “Failed to load shared library: %1 不是有效的 Win32 应用程序。”

Additional comments

epffi.load(options.path)出错,是不是koffi不兼容windows

import path from "path";
import { createEpffi } from "electron-prokit";
import { getResourcesPath } from "../util";

export const {sum} = createEpffi({
  path: path.join(__dirname,getResourcesPath('resources/dll/sum.dylib')),
  function:{
    functionName:'sum',
    returnType:'int',
    inputs:['int','int']
  }
})

export const { mul,div } = createEpffi({
  path: path.join(__dirname, getResourcesPath("resources/dll/mul_and_div.dylib")),
  function: [
    {
      functionName: "mul",
      returnType: "int",
      inputs: ["int", "int"],
    },
    {
      functionName: "div",
      returnType: "int",
      inputs: ["int", "int"],
    },
  ],
});

是因为这个地方是导入的dylib,Windows无法识别,如果Windows要运行的话可以把源码里面resources里面的两个C文件编译成DLL文件,这个我改一下,让play支持一下windows,如果着急跑项目可以先在ffi,里面mock一下这两个方法

好的

已修复