« sample p/invoke VS.NET 2003 solution | Main | progress with windows and opengl... towards a solution! »
Friday
May272005

oh, the joy won't stop.

I was getting somewhere with the plan I laid out in my last post... except I couldn't get my C# code to call a function exported in the sample unmanaged C++ DLL created by VS.NET; I'd get a System.DllNotFoundException when I tried to call the function. I tried putting the dll into various places where Windows is supposed to search for dll's, but not dice. I decide to restart the computer -- a nice soft reset, quit everything nicely.

When the system comes back up, I launch the VS.NET solution file with all the various projects I've been working on... and VS.NET hangs. Okay, I launch it again... and VS.NET hangs again. I launch it again... and then give up. I didn't need that solution anyways.

I decide to find a complete working example of just the part that's troubling me, calling unmanaged functions from managed code... The example I find is actually already on my computer, in C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Samples\Technologies\Interop\PlatformInvoke\Custom\. Why didn't I look there before? This sample is set up to build directly from the command line, with makefiles. Makefiles! Lovely! With a makefile, I can directly change command line options, and ellide all but the vital ones. Amazingly, all it takes to make a dll is cl.exe /clr /LD MyClass.cpp... Poof, there's MyClass.dll. Amazing. This one little example seems to have everything I need. Too bad it's almost midnight. Every day brings its own surprises.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>