我在我的C#程序中声明了一个DLL导入,如下所示:
[DllImport("C:\\c_keycode.dll", EntryPoint = "generateKeyCode",
CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr generateKeyCode(char[] serial, char[] option, char c_type);
Run Code Online (Sandbox Code Playgroud)
它引用了generateKeyCode()我的DLL内部的函数.
以下是导致错误的代码(使用的断点):
const char* generateKeyCode(char serial[],
char option[],
char c_type)
{
returnBufferString = "";
SHA1_CTX context;
int optionLength = 0;
#ifdef WIN32
unsigned char buffer[16384] = {0};
#else
unsigned char buffer[256] = {0};
#endif
//char output[80];
char keycode[OPTION_KEY_LENGTH+1] = "";
int digest_array_size = 10; //default value for digest array size
unsigned char digest[20] = {0};
char optx[24] = {0};
char c_type_upper; …Run Code Online (Sandbox Code Playgroud) 我试图找出正确的用法funcall.我有这个功能:
(defun frame-add-slot (frame slot)
(push (list slot) (rest (assoc frame *frames*))))
Run Code Online (Sandbox Code Playgroud)
而我正试图让其他功能调用它.
(defun frame-add-subframe (superframe subframe)
(let ((res (push (list subframe) (rest *frames*))))
(funcall (frame-add-slot) subframe 'ako))))
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试以这种方式传递两个参数时,clisp告诉我被调用的函数接收的参数太少.我究竟做错了什么?*Frames*是我的知识基础.它看起来像这样:
(setf *frames* '((mammal
(eats
(:value meat)
(:if-needed (food))))
(4-legged-animal
(ako
(:type mammal)
(:default beings))
(blood
(:type warm-blooded)))
(husky
(ako
(:type dog))
(origin
(:value alaska)
(:default north-america))
(roots
(:value unknown)))
(dog
(ako
(:type 4-legged-animal))
(exterior
(:value furry)
(:default skin)))
(abner
(isa
(:type husky)
(:default dog))
(shape
(:weight 40-lbs) …Run Code Online (Sandbox Code Playgroud)