I have gone through the samples. I haven't been able to get it work using those examples. My c isn't great. I believe the problem is in the C. Here is the code:
// This is the main DLL file.
#include "stdlib.h"
#include "stdio.h"
#include "stdafx.h"
#include "Bridge.h"
extern "C" {
#include <string.h>
}
#using "dotNetAssembly\bin\dotNetAssembly.dll"
using namespace System;
using namespace dotNetAssembly;
extern "C"
{
__declspec(dllexport) char * decrypt_pin(char *input)
{
String __gc *managed_input = new String(input);
mcDotNetClass __gc *DotNetObject;
DotNetObject = new mcDotNetClass;
System:

iagnostics:

ebugger::Log(1, "Made it past new", "Made it past new");
char tmp __gc[] = System::Text::Encoding::UTF8->GetBytes(DotNetObject->DecryptPin(input));
char __pin *value = &tmp[0];
//strncpy(input, value, 4); //Max pin size should be 4
return value;
}
__declspec(dllexport) int Done(char *input, char *output)
{
try
{
String __gc *managed_input = new String(input);
mcDotNetClass __gc *DotNetObject;
DotNetObject = new mcDotNetClass;
System:

iagnostics:

ebugger::Log(1, "Made it past new", "Made it past new");
char tmp __gc[] = System::Text::Encoding::UTF8->GetBytes(DotNetObject->DecryptPin(input));
char __pin *value = &tmp[0];
strncpy(output, value, tmp->Length); //Max pin size should be 4
return tmp->Length;
}
catch (...)
{
return 0;
}
}
__declspec(dllexport) int bint(int input)
{
mcDotNetClass __gc *DotNetObject;
DotNetObject = new mcDotNetClass;
return DotNetObject->test_integer(input);
}
__declspec(dllexport) char * bst(char *input, int buflen)
{
String __gc *managed_input = new String(input);
mcDotNetClass __gc *DotNetObject;
DotNetObject = new mcDotNetClass;
char tmp __gc[] = System::Text::Encoding::UTF8->GetBytes(DotNetObject->test_string(input));
char __pin *value = &tmp[0];
strncpy(input, value, buflen);
return input;
}
__declspec(dllexport) int barr(int *values, int len)
{
int i, cnt;
Array __gc *managed_values;
mcDotNetClass __gc *DotNetObject;
managed_values = Array::CreateInstance(__typeof(System::Int32),len);
cnt = managed_values->GetLength(0);
for (i=0;i < cnt;i++) {
managed_values->SetValue(__box(values
), i);
}
DotNetObject = new mcDotNetClass;
return DotNetObject->test_array(managed_values);
}
}