浮動小数型のデータのやりとり
C#のDecimal型については、そのままC++で簡易に受け取ることが出来ませんので、 受け渡す際には、
など、ご自身の用途によって工夫が必要となるでしょう。
#include <windows.h>
#include <cstddef>
#include <iostream>
using
namespace
std;
#define DLLEXPORT __declspec(dllexport) WINAPI
// float受け取り
extern
"C"
void
DLLEXPORT dllfloat(
const
float
a) {
cout << fixed << a << endl;
}
// double受け取り
DLLEXPORT dlldouble(
double
b) {
cout << fixed << b << endl;
System;
System.Runtime.InteropServices;
test1
{
internal
class
Program
[DllImport(
"Dll1.dll"
)]
static
dllfloat(
a);
dlldouble(
b);
Main(
string
[] args)
a = 100.33f;
dllfloat(a);
b = 200.4444d;
dlldouble(b);
Console.ReadKey();