Closed GoogleCodeExporter closed 9 years ago
I'm getting a similar issue when running my C# application against the
pre-built v1972 .NET Win32 Google.OrTools.ConstraintSolver.dll binary. An inner
exception contains:
Unable to load DLL
'c:\Users\Laurent\Documents\or-tools\bin\Google.OrTools.ConstraintSolver.dll':
The specified module could not be found. (Exception from HRESULT: 0x8007007E)
For now I'll need to revert to a previous release.
Original comment by t...@zanyants.com
on 3 Aug 2012 at 11:28
I tried previous release 1930 too, but same error occurs.
Original comment by msti...@gmail.com
on 3 Aug 2012 at 11:32
Full stack trace is:
System.TypeInitializationException: The type initializer for
'Google.OrTools.Graph.operations_researchPINVOKE' threw an exception.
---> System.TypeInitializationException: The type initializer for
'SWIGExceptionHelper' threw an exception.
---> System.DllNotFoundException:
Unable to load DLL
'c:\Users\Laurent\Documents\x64-or-tools\bin\Google.OrTools.Graph.dll': The
specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Google.OrTools.Graph.operations_researchPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_operations_research(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
at Google.OrTools.Graph.operations_researchPINVOKE.SWIGExceptionHelper..cctor()
--- End of inner exception stack trace ---
at Google.OrTools.Graph.operations_researchPINVOKE.SWIGExceptionHelper..ctor()
at Google.OrTools.Graph.operations_researchPINVOKE..cctor()
--- End of inner exception stack trace ---
at Google.OrTools.Graph.operations_researchPINVOKE.new_StarGraph__SWIG_1(Int32 jarg1, Int32 jarg2)
at Google.OrTools.Graph.StarGraph..ctor(Int32 max_num_nodes, Int32 max_num_arcs)
at CsFlow.SolveMinCostFlow() in C:\Users\m\Desktop\or-tools.x64\examples\csharp\csflow.cs:line 31
Original comment by msti...@gmail.com
on 9 Aug 2012 at 6:37
[deleted comment]
After inspecting the dll in .NET Reflector I found that hardcoded absolute
paths are used in [DllImport] interface generated by SWIG.
Check the code below...
internal class operations_researchPINVOKE
{
// Fields
protected static SWIGExceptionHelper swigExceptionHelper;
protected static SWIGStringHelper swigStringHelper;
// Methods
static operations_researchPINVOKE();
public operations_researchPINVOKE();
[DllImport(@"c:\Users\Laurent\Documents\x64-or-tools\bin\Google.OrTools.Graph.dll", EntryPoint="CSharp_delete_EbertLinearSumAssignment")]
public static extern void delete_EbertLinearSumAssignment(HandleRef jarg1);
[DllImport(@"c:\Users\Laurent\Documents\x64-or-tools\bin\Google.OrTools.Graph.dll", EntryPoint="CSharp_delete_ForwardEbertLinearSumAssignment")]
public static extern void delete_ForwardEbertLinearSumAssignment(HandleRef jarg1);
[DllImport(@"c:\Users\Laurent\Documents\x64-or-tools\bin\Google.OrTools.Graph.dll", EntryPoint="CSharp_delete_ForwardStarGraph")]
public static extern void delete_ForwardStarGraph(HandleRef jarg1);
[DllImport(@"c:\Users\Laurent\Documents\x64-or-tools\bin\Google.OrTools.Graph.dll", EntryPoint="CSharp_delete_ForwardStarStaticGraph")]
public static extern void delete_ForwardStarStaticGraph(HandleRef jarg1);
[DllImport(@"c:\Users\Laurent\Documents\x64-or-tools\bin\Google.OrTools.Graph.dll", EntryPoint="CSharp_delete_LongResultCallback1")]
public static extern void delete_LongResultCallback1(HandleRef jarg1);
[DllImport(@"c:\Users\Laurent\Documents\x64-or-tools\bin\Google.OrTools.Graph.dll", EntryPoint="CSharp_delete_LongResultCallback2")]
public static extern void delete_LongResultCallback2(HandleRef jarg1);
...
Original comment by msti...@gmail.com
on 9 Aug 2012 at 6:46
I have finally solved this.
In Makefile.csharp.mk set
IMPORTPREFIX=
That will fix [DllImport] declarations and after build, resulting dll will work
normally...
Original comment by msti...@gmail.com
on 9 Aug 2012 at 12:49
Hello,
I have fixed this too.
I guess you will need to add the or-tools/bin in your path for swig to find the
dll.
Thanks
Original comment by lper...@google.com
on 9 Aug 2012 at 7:39
It works better with
IMPORTPREFIX=
as you don't need to have or-tools/bin in path.
IMPORTPREFIX is used only for swig dllimport switch, which is not used to point
to the library itself, but to generate [DllImport] declarations in generated cs
files.
See src\gen\com\google\ortools\graph\operations_researchPINVOKE.cs
-dllimport "$(IMPORTPREFIX)Google.OrTools.LinearSolver.$(SHAREDLIBEXT)"
Latest .NET releases throw following exception:
"Unable to load DLL '\\bin\\Google.OrTools.Graph.dll': The specified module
could not be found.
Original comment by msti...@gmail.com
on 10 Aug 2012 at 6:39
indeed.
I am uploading new archives.
They run ok on my computer.
Thanks
Original comment by laurent....@gmail.com
on 10 Aug 2012 at 9:18
Original issue reported on code.google.com by
msti...@gmail.com
on 2 Aug 2012 at 10:29