Jump to content

Eltion

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Eltion

  1. DllOpen returns 1.
  2. $a = DllOpen("testdll.dll") $c = DllCall($a, "int:cdecl", "add","int",5,"int",5) MsgBox(0,"",@error) It never goes to the MsgBox so I don't see the @error at all
  3. Hi, I have a managed class dll from c#. Using this guide here https://www.codeproject.com/articles/556582/usingplusc-plusfromplusnativeplusc-b-bpluswith I was able to create a wrapper around my managed library with C++/CLI. Then created a unmanaged c++ library using that. I've tested it in a console application and everything works fine, but when I try to access the unmanaged c++ library using DllCall it does not work. #C sharp public class MathTest { public int add(int x, int y) { return x + y; } } #Wrapper #include "pch.h" #using "TEST3.dll" #include <msclr\auto_gcroot.h> #include "Wrapper.h" using namespace System::Runtime::InteropServices; class MathTestWrapperPrivate { public: msclr::auto_gcroot<MathTest^> MathTest; }; MathTestWrapper::MathTestWrapper() { _private = new MathTestWrapperPrivate(); _private->MathTest = gcnew MathTest(); } int MathTestWrapper::add(int a, int b) { return _private->MathTest->add(a, b); } #Unmanaged dll #include "pch.h" #include "testdll.h" #include "Wrapper.h" int add(int a, int b) { MathTestWrapper w; return w.add(a, b); } #testdll.h #pragma once #ifdef TESTDLL_EXPORTS #define TESTDLL __declspec(dllexport) #else #define TESTDLL __declspec(dllimport) #endif extern "C" TESTDLL int add(int a, int b);
×
×
  • Create New...