C++ Call dll function [duplicate] - c++

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Possible to call C++ code from C#?
Many years ago I did develp in C++ using Visual Studio 6.
Nowdays, I should writing a simple console application in order to call some dll function written in c++.
Note that none of that functions are exposed in .NET world, so I cannot write any wrap, instead I just need to remeber something about c++.
The first thing I got in my mind is how to call (in .net, referencing) native dll. Is it accomplished simply by "using ddlFilePath" instruction?
Finally, but not less important, wich are essential differents between C++ console app created with Visual Studio 6 and C++ Console app created with Visual Studio 2010?

Please look at this similar question:
Using .dll in Visual Studio 2010 C++
The first answer is very well written (I think)
The essential difference between C++ programs written in Visual Studio 6 and programs written in Visual Studio 2010 is the improvement and syntax change in the C++ language. The language should be backwards compatible, so programs written in Visual Studio 6 should compile in Visual Studio 10 (but not the other way!)

To use a non-COM DLL in .NET, you have to use Platform Invoke.

Related

c++ in visual studio

I'm learning C++ but I have seen that Visual Studio has Visual C++. I searched about the difference but I haven't found anything satisfying.
The only thing I found was, that Visual C++ is a version of C++ but with more libraries. Please correct me if I'm wrong.
So I have two questions:
What's the difference between C++ and Visual C++?
And can I write normal C++ in Visual Studio? If I can't write normal C++ in Visual Studio, where do I write it the best in.
I want to try to make some small games.
C++ is a programming language and Visual C++ is a Microsoft's C++ compiler.
Visual C++: less portable, but has specialized libraries which may make you stick with Windows.

Where can I get afx...h files? [duplicate]

This question already has answers here:
Is MFC only available with Visual Studio, and not Visual C++ Express?
(2 answers)
Closed 9 years ago.
I'm developing with an API and the API requires the afxsock.h among other afx... headers. After searching online, it seems that my VS Express isn't enough, so I looked to purchase the product at microsoft. Unfortunately it's 700$ and as a beginning programmer, it makes no sense for me to drop that on 1 project which I am using to teach myself c++. (I.e. I still don't know if I want to program long term in C++ or another language).
In any case, I was wondering if there was some sort of work around to get the afx (or more appropriately the MFC) files?
Note that I have Windows 8, Visual Studio 2012, and I've downloaded the Windows Development Kit for Windows 8, but still can't compile because I'm getting missing afx errors.
The AFX prefix stands for Application Framework Extensions, which was the original name for the MFC (Microsoft Foundation Classes) libraries. The file names were set in stone before the name was changed to MFC, and it was too late to change them.
So you need MFC in order to use those headers. Unfortunately, the Express versions of Visual Studio do not include MFC (or ATL). You can only develop MFC applications using the Standard, Professional, or higher editions of Visual Studio.
If you are a student, you have a couple of great options:
You can can join Microsoft's DreamSpark program, which is free to students and entitles you to some great free downloads, including VS 2012 Professional, VS 2010 Professional, and recent server versions of Windows.
Alternatively, you can join the IEEE for a very low cost. The
IEEE student membership entitles you to download many Microsoft tools, including the Ultimate editions of Visual Studio. See this page for more information. (Although that page mention VS 2010, VS 2012 is actually available.)
Otherwise, you will have to either buy Visual Studio Standard/Professional outright, or join MSDN.
Alternatively, you could use the winsock2 API, which is part of the Windows SDK rather than MFC. Get started with the documentation here. The Windows SDK is what you're getting when you downloaded the "Windows Development Kit for Windows 8". It includes everything you need to link to native Win32 libraries, but it does not include the MFC framework.
In addition to the IEEE "student membership" option that someone else linked to, you may want to consider Microsoft's BizSpark program which will give you access to more than just Visual Studio. I do not know if you qualify for it, but it's worth looking into.
With that said, it's time to step onto the soapbox and add some commentary: I understand the problem of API of choice having a dependency on MFC, but realistically speaking developing a trading program is neither particularly easy nor a good place for you to start. In addition, starting with MFC is probably not a good idea unless you want to specifically focus on becoming an MFC developer. If you are set on C++ you would be better served focusing your efforts on learning C++11. Or at least learning it first. Once you are comfortable with that, then you can focus on learning GUI programming using any of the many frameworks available.
Just my $0.02.

Is it possible to open up and execute a Visual Studio C++ Win32 Console Application project with Visual Studio 6.0 C++?

My school still uses MS VS 6.0 C++, don't ask why...
Thanks in advance!
VS 6 can't open a VS 2010 project file directly.
You can create a new workspace in VS 6, and add your existing files to it.
Chances are, however, that the code won't compile -- VC++ 6 is quite old (predates the 1998 standard) so a lot of modern code won't work with it. Depending on how you've written your code, porting it to work with VC++ 6 may be anywhere from fairly trivial to essentially a complete rewrite from the ground up.

C++ snippet support in Visual Studio 2010

What is the best way to use snippets in Visual C++ 2010? I know about Visual AssistX and love it, but I'd prefer some free solution. I read question: C++ snippet support in visual studio? , but there is no answer to my question.
You can always create a poor-man's snippet by writing a Visual Studio Macro (written in VBScript and utilizing some VS-provided APIs) to insert a certain block of code in your file.

Visual C++ .net vs C++

Kindly can any one point to the main differences between C++ and Visual C++ .net?
Is Visual C++ .net a managed code like C# and VB? Does it use the same FCL and BCL? Can C# and VB dlls be consumed from a visual C++ .Net project?
C++ is a language; Visual C++ is a compiler for the C, C++, and C++/CLI languages.
What you probably mean to ask about is the difference between C++ and C++/CLI, but a quick SO search will demonstrate that question to already be answered many times over.
Is Visual C++ .net a managed code like C# and VB?
C++/CLI is, yes.
Does it use the same FCL and BCL?
Yes.
Can C# and VB dlls be consumed from a visual C++ .Net project?
From a C++/CLI project, yes; and the reverse is also true.
C++ is a language.
Microsoft Visual C++ is a development environment for the C++ language. It includes a compiler, editor, debugger and much more.