0

I have written code in a .NET Framework C++ file. The code uses the Articares DLL to connect with the device through an IP address. Where instance is simply creating an instance of the classes I want to use from the DLL. instance.EstablishConnection() is the function i want to call from the class. The below code works perfectly in x86.

#include "pch.h"
#include "windows.h"
#include <iostream>
#include <chrono>
#include <thread>
#include<cstring>
#include <vector>
#include "Complex.h"

using namespace System;
using namespace Articares;
using namespace NLog;

int main(array<System::String^>^ args)
{
    //Creating instances of the classes ----------------------------------------------------
    Articares::Core::ArticaresComm instance;
    Articares::Core::HMANData instance2;
    Articares::Core::TargetParams instance3;

    //Connecting to HMan -------------------------------------------------------------------
    instance.EstablishConnection("192.168.102.1", 3000);
    std::cout << "Connection with HMan established\n";
   return 0;
}

However, i want to be able to use the DLLs in the unreal engine C++ file to replicate this code i have written.

But the error name must be a namespace name appears when i try to declare the DLLs in the unreal engine C++ file.

Could anybody tell me how to fix this problem to be able to use my x86 DLLs in the unreal engine C++ code?

Thanks.

  • `name must be a namespace name` On which line the error occurred? – Minxin Yu - MSFT Jul 26 '22 at 02:41
  • @Minxin Yu, the ````name must be a namespace```` has occurred at ```` using namespace Articares ```` and ````using namespace NLog```` however i have added both of these Dlls as references and they work perfectly in the functioning code. –  Jul 26 '22 at 12:09

1 Answers1

0

Are you using C++ DLL or . NET DLL?

For C++ DLL, you need to add dependencies. Walkthrough: Create and use your own Dynamic Link Library (C++)

For .NET DLL, You are calling managed code in unmanaged C++. Use Exposing .NET components to COM

For your reference: using c# dll in project c++

Minxin Yu - MSFT
  • 2,234
  • 1
  • 3
  • 14