C 呼叫外部C 生成DLL

2021-06-08 23:35:34 字數 1074 閱讀 5591

【生成dll c++檔案部分內容】

[.h檔案] //外部呼叫函式宣告

#pragma once

#ifndef kinectdatagenerator_h

#define kinectdatagenerator_h

// initialize kinect

extern "c" _declspec ( dllexport ) void kinectinitial();

//get skeleton joint position

extern "c" _declspec ( dllexport ) void getskeletonjointposition(float xnapointx,float xnapointy,float xnapointz);

//get depth & color image data

extern "c" _declspec ( dllexport ) void getdepthdata(unsigned char data);

extern "c" _declspec ( dllexport ) void getrgbacameradata(unsigned char data);

#endif

[.cpp檔案] //函式實現

void kinectinitial()

void getskelejointpostion(float jointpositionx, float jointpositiony, float jointpositionz)

}void getrgbacameradata(uchar data)

void getdepthdata(uchar data)

【c#中對dll檔案的呼叫】

//read dll and fetch data from it

public class kinectdatageneratordll

kinectdatageneratordll datageneratordll;

datageneratordll = new kinectdatageneratordll();

然後就是函式呼叫部分了

C 生成dll呼叫

用visual c 生成的dll檔案已經和以前的dll檔案有了本質上的區別。用visual c 生成的dll檔案在程式設計中更多的表現為一種類 class 或者類庫 class library 製作乙個元件 1.首先建立乙個新類庫工程檔案 file new project visual c proj...

C 呼叫C 生成的dll

本文將介紹c 中通過dll來呼叫c 首先建立c 的 類庫 工程cshapedll。然後輸入如下 csharp view plain copy c 通過dll呼叫c by morewindows using system using system.collections.generic using s...

C語言生成DLL供C 呼叫

編寫c程式如下 include stdio.h declspec dllexport void myfun 儲存,取名為my.c 執行 vs 命令提示,cl c 路徑 my.c 執行以後會生成 my.obj,預設在vs安裝資料夾的vc目錄下 再執行 link dll 路徑 my.obj 在同乙個目錄...