I may have taken us off track with my last posting.
Frankly, I don't know if what I'm trying to do has anything to do with unmanaged code. But I do know that the file can only be compiled with the C++ compiler, not the C# compiler.
And I apologize if I'm asking too much of a C/C++ question in a C# forum.
One of the things that's mentioned in every VS2005 book that I've seen is "language interoperability" -- the idea that, because of the common IL and CLR, it's easy to build an application using VB
for the GUI and VC# for the backend. Or similar mixing of languages.
Yet, I don't see any way to include source files from multiple languages in a single project.
And (I think) that's what I want to do. I want to write most of my code in C#. The one "common file" that has to be compiled both under Windows and in the embedded system won't compile for C#. It WILL, however, compile for a C++ console program.
Sadly, I can't tell if this C++ program is being built as managed code or unmanaged code. I don't fool around with pointers, for example. And it compiles cleanly with the /CLR flag.
But the syntax is C++, not C#. The include files are for C++, not C#. So C++ compiles it without a warning, whereas C# won't compile it at all.
And it makes extensive use of what I call the C runtime libraries. It calls socket() and select() rather than System.IO.Socket() [sp].
So it uses WinSock, rather than the .NET implementation of sockets.
And it WORKS, compiled as part of a command-line application for C++.
But I need it to be part of a Windows Forms-based application in C#.
You had mentioned the possibility of making calls to the compiled C / C++ file from C#. Can you add some detail on the mechanism for doing that?
I can't tell you how grateful I am for your insights. I've been programming for 30 years, and it's very frustrating being tripped up by the language mechanics of getting things done. I did some Windows programming before .NET came along, then switched to embedded programming (done in C) and I'm finding it difficult to marry the two.