Wow! It's been a while since I last posted.

It has literally been probably over a decade since I created a DLL file in C++ to use in VB6. However, I want to do an experiment before I even attempt my real method. I created a very basic method in C++ that I compiled into a DLL file:

cpp Code:
  1. #include <iostream>
  2.  
  3. extern "C" __declspec(dllexport) int AddNumbers(int a, int b)
  4. {
  5.     return a + b;
  6. }

Nothing special. Just add two integers and return the result. Compiles into the DLL just fine. And it only contains main.cpp. No headers or anything. The problem is when I try using this in VB6. I move my copied DLL file in with the same directory as my VB6 project and ran this code:

vb6 Code:
  1. Option Explicit
  2.  
  3. Private Declare Function AddNumbers Lib "Test.dll" (ByVal a As Long, ByVal b As Long) As Long
  4.  
  5.  
  6. Private Sub Form_Load()
  7.   Dim a As Long
  8.   Dim b As Long
  9.   Dim result As Long
  10.  
  11.   a = 1
  12.   b = 2
  13.  
  14.   result = AddNumbers(a, b)
  15.  
  16.   MsgBox "The result is " & result
  17. End Sub

I end up with an error saying Run-time error '48': File not found.
I compiled it into an exe and ran it. Again, file not found.
I then made efforts to copy the DLL into both the system32 and sysWOW64 directories of Windows. Again, file not found.
I then made the subtle attempt at typing in the full path of the DLL: Private Declare Function AddNumbers Lib "D:\Source Code\VB6\Test.dll" (ByVal a As Long, ByVal b As Long) As Long. Ran the exe, and again, file not found.
So I was like screw it and regsvr32ed all 3 dll files under administrator privilages. Registered just fine. Ran the exe and again... file not found.

I have never had this issue making DLL files before. But, then again, in the past, I was using a much older C++ that required .def files when making DLLs, which is no longer needed to my knowledge. But even so, it cannot find the DLL file to begin with. Tried finding solutions online, with zero luck, and I even went out of my way to get help from both ChatGPT and Google Bard. The AI made attempts to help me but nothing was working. Does anyone have any bright ideas on pulling off what should be simple? Thank you in advance.