#include "Native.h"
#include <iostream>
#include <windows.h>
HEAD void CallingConvention Test1()
{
SetLastError(2);
printf("call success\n");
}
HEAD void CallingConvention TestLogA(const char *log)
{
printf("logA:%s\n", log);
}
HEAD void CallingConvention Test_BasicData(char d1, short d2, int d3, long long d4, float d5, double d6)
{
}
HEAD void CallingConvention Test_BasicDataRef(char &d1, short &d2, int &d3, long long &d4, float &d5, double &d6)
{
d1 = 1;
d2 = 2;
d3 = 3;
d4 = 4;
d5 = 5.5f;
d6 = 6.6;
}
HEAD void CallingConvention Test_BasicDataPointer(char *d1, short *d2, int *d3, long long *d4, float *d5, double *d6)
{
*d1 = 10;
*d2 = 20;
*d3 = 30;
*d4 = 40;
*d5 = 15.5f;
*d6 = 16.6;
}
HEAD float CallingConvention Test_Add(float num1, float num2)
{
return num1 + num2;
}
HEAD void CallingConvention Test_BasicDataArr(int *arr1, float *arr2)
{
arr1[0] = 11;
arr1[1] = 22;
arr1[2] = 33;
arr2[0] = 22.2f;
arr2[1] = 22.2f;
arr2[2] = 22.2f;
arr2[3] = 22.2f;
}
int intarr[5] = {1,2,3,4,5};
HEAD void* CallingConvention Test_BasicDataRet()
{
return intarr;
}
HEAD void CallingConvention Test_BasicDataString(char *str)
{
printf("%s\n", str);
}
HEAD void CallingConvention Test_BasicDataByteArr(char *str)
{
printf("%s\n", str);
}
HEAD void CallingConvention Test_Struct(StructA param)
{
param.id = 123;
}
StructA structa;
struct FrameInfo
{
char username[20];
double pts;
};
struct Frame
{
int width; //0-4
int height;//4-8
int format;//8-12
int linesize[4]; //12-28
unsigned char* data[4];//32-64
FrameInfo *info; //64-72
};
Frame frame;
FrameInfo info;
HEAD void* CallingConvention Test_StructRet()
{
frame.width = 1920;
frame.height = 1080;
frame.format = 0;
for (int i = 0; i < 4; i++)
{
frame.linesize[i] = 100 * i;
frame.data[i] = new unsigned char[10];
for (int j = 0; j < 10; j++)
{
frame.data[i][j] = i;
}
}
info.pts = 12.5;
memset(info.username, 0, 20);
memcpy(info.username, "hello world", strlen("hello world"));
frame.info = &info;
return &frame;
}
HEAD void* CallingConvention ConvertChildStruct(ChildStruct *cs)
{
return cs;
}
HEAD float CallingConvention Sum(int length, ...)
{
char* head = (char*)&length;
int num1 = *(long long*)(head + 8);
int num2 = *(long long*)(head + 16);
int num3 = *(long long*)(head + 24);
int num4 = *(long long*)(head + 32);
double num5 = *(double*)(head + 40);
return (num1 + num2 + num3 + num4 + num5) / length;
}
HEAD void CallingConvention SetLogFuncPointer(pfun p)
{
int ret = p(0, NULL);
printf("");
}
//HEAD void CallingConvention TestLog(const char *log)
//{
// printf("log:%s\n", log);
//}
没有合适的资源?快使用搜索试试~ 我知道了~
- -C#调用C++库shili
共17个文件
user:3个
sln:2个
filters:2个
需积分: 5 0 下载量 29 浏览量
2023-03-12
22:19:30
上传
评论
收藏 14KB ZIP 举报
温馨提示
- -C#调用C++库shili
资源推荐
资源详情
资源评论
收起资源包目录
C#调用C++库.zip (17个子文件)
lesson_dll-main
src
CallNativeDllCpp
CallNativeDllCpp.vcxproj 6KB
main.cpp 388B
CallNativeDllCpp.vcxproj.filters 928B
CallNativeDllCpp.vcxproj.user 600B
CallNativeDllCSharp.sln 4KB
NativeDll
NativeDll.vcxproj.filters 1KB
NativeDll.vcxproj.user 162B
Native.h 2KB
NativeDll.vcxproj 8KB
Native.cpp 3KB
CallNativeDllCSharp
App.config 184B
CallNativeDllCSharp.csproj.user 359B
CallNativeDllCSharp.sln 4KB
Properties
AssemblyInfo.cs 1KB
Program.cs 3KB
CallNativeDllCSharp.csproj 2KB
.gitignore 110B
共 17 条
- 1
资源评论
lfw2019
- 粉丝: 310
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功