Loading .NET assembly: file does not exist error

I am trying to load a gdal_wrap.dll assembly from [gisinternals.com][1]:

from clr import AddReferenceToFileAndPath as addref
addref("c:/gdal/gdal_wrap.dll")

But I am getting an error message:

Runtime error (IOException): file does not exist: c:\gdal\gdal_wrap.dll

But path: “c:/gdal/gdal_wrap.dll” is correct.

Below attached gdal_wrap.dll is 32 bit compiled, and I am using 32 bit version of Rhino 5 (5.12.50810.13095, 08/10/2015).

Why can’t the mentioned .dll be loaded?
Thank you for the reply.

gdal_wrap.zip (28.4 KB)
[1]: http://download.gisinternals.com/sdk/downloads/release-1500-gdal-1-11-1-mapserver-6-4-1.zip

This does not appear to be a .NET assembly.

Thank you @dale.

gdal_wrap.dll was downloaded from gdal’s C# bindings folder:

Here is the .zip for all the files.

Does this mean that the fact that mentioned .dll is in their Csharp folder, does not necessarily mean it’s a .NET assembly? Is there a way I could check if an assembly is a .NET or not?

Use the Dependency Walker.

A managed DLL / Application will have a primary dependency on MSCOREE.DLL. So, if you open the DLL, RHP, etc., in Dependency Walker you have no problems in telling a managed library from an unmanaged one.

Understood.
I tried opening a different .dll from the same folder: gdal_csharp.dll (attached below). When I open it in Dependency Walker, it has a primary dependency to MSCOREE.DLL.

However it does not allow to be imported. It raises: “No module named gdal_csharp” on the last line:

from clr import AddReferenceToFileAndPath as addref
addref("c:/gdal/gdal_sharp.dll")
importedAssembly = "gdal_csharp" in [assembly.GetName().Name for assembly in clr.References]
print "importedAssembly: ", importedAssembly   # prints: True

import gdal_csharp as gdalcs

gdal_csharp.zip (23.2 KB)

I don’t know anything about the library you are trying to use - sorry. But the attached works.

Djordje.zip (1.9 KB)

Thank you @dale.

I am familiar with calling methods from an assembly.
Was just puzzled why upper one was not able to imported. Looks like I needed to use “import OSGeo.GDAL as gdalcs” instead.

I hope the autocomplete of available namespaces from loaded assembly will be added to Rhino 6.