I am using [DllImport (“netprofm.dll”)] and accessing this GetConnectivity() function from it.
When I am running the program, it is showing an error that function or .dll file does not exist.
Code:-
[DllImport(“netprofm.dll”, EntryPoint =“GetConnectivity”)]
public static extern int GetConnectivity(
System.IntPtr pConnectivity
);
This function supposed to be in the file.
Does anyone has any solution or alternative for this problem.
You’d have to include that DLL in your project for this to work, and it would only work on Windows, and it’s a very odd and probably non-working solution for Unity since I’ve never seen anyone use or try to use this.
There are literally a ton of “solutions” to this problem.
Most will attempt to reach a webserver - this is slow because it requires waiting for a timeout. It’s also riddled with issues since the time to reach a server varies, and the server may be unreachable from some networks (ie state firewalls, like in China, may prohibit access).
Unfortunately, that’s also the only viable solution.
But then again, why do you need to test this? If for instance you need to make service calls or webrequests, you just make them and respond to any failures (ie timeout => service is unavailable).
A dll, or Dynamic Linked Library is (9/10) a C++ file designed to integrate into C#, the fact it claims it does not exist, means more than likely it is an issue with the build process somewhere along the line. Have you changed any of the code that could possibly influence the DLL file mentioned, is this on a fresh install, what conditions are we to work with if I was to "replicate this bug’ The “Function supposed to be in the file” I 100% agree with, however if you edit, or use something that mimics this would change it.
An example (totally not related but a good example) is Random.Range() which version? UnityEngine.Random.Range() or System.Random.Range()
I assume (hopefully) you did not create a file that has the same method (GetConnectivity)