Discussion:
Interop call cannot find my dll
(too old to reply)
John
2009-11-22 20:04:12 UTC
Permalink
I have a c++ dll, written by me, with functions that I want to import
into a VS2008 C# windows form app (.net framework 3.5sp1). This is
about as simple and straightforward an interop scenario as you can
imagine.

I do this:
[DllImport("DataLib.dll")]
public static extern int OpenHistoricalTicker(string Ticker, int
Period);

and later on make a call to OpenHistoricalTicker. It throws an
exception telling me it can't find DataLib.dll.

I've placed DataLib.dll in the C# executable's directory, in
Windows/System32, and every where else I can imagine. I can call this
function in DataLib.dll from a C++ program. I've tried placing the
fully qualified path into the DllImport attribute. I've checked
folder permissions. Nothing seems to help.

Thanks in advance for any suggestions.
John
2009-11-22 21:41:33 UTC
Permalink
Never mind - found it. My c++ dll was dependent on another dll which
was not available.
Post by John
I have a c++ dll, written by me, with functions that I want to import
into a VS2008 C# windows form app (.net framework 3.5sp1). This is
about as simple and straightforward an interop scenario as you can
imagine.
[DllImport("DataLib.dll")]
public static extern int OpenHistoricalTicker(string Ticker, int
Period);
and later on make a call to OpenHistoricalTicker. It throws an
exception telling me it can't find DataLib.dll.
I've placed DataLib.dll in the C# executable's directory, in
Windows/System32, and every where else I can imagine. I can call this
function in DataLib.dll from a C++ program. I've tried placing the
fully qualified path into the DllImport attribute. I've checked
folder permissions. Nothing seems to help.
Thanks in advance for any suggestions.
Loading...