Software Archive
Read-only legacy content
17061 Discussions

Use Intel Parallel Studio to call C++'s Native code dll

thanhnt14
Beginner
359 Views

Hi all.
I want to user Intel Parallel Studio to call C++'s Native code dll but idon't know how touse it.
Please help me?
Thanks!

0 Kudos
5 Replies
thanhnt14
Beginner
359 Views
Up Up, please help me.
0 Kudos
robert-reed
Valued Contributor II
359 Views
Have you read the Intel documentation? Can you be a bit more specific regarding your need? There are people who will respond if they can understand what you are requesting, but with what you've written so far, I'm not quite sure what your request means.
0 Kudos
thanhnt14
Beginner
359 Views
Have you read the Intel documentation? Can you be a bit more specific regarding your need? There are people who will respond if they can understand what you are requesting, but with what you've written so far, I'm not quite sure what your request means.

I have a program(write by C#) and some dll file(write by C++). Now i want use Intel Parallel Studio to call this dll files in C# program.
Do you understand my idea?
0 Kudos
robert-reed
Valued Contributor II
359 Views
I have little better idea of what you're trying to do. It sounds like you've got some managed code written in C# and you are writing some C++ code that you'd like to stick in an unmanaged DLL and call from the C# code. You also mention Intel Parallel Studio, so I'd guess that you want to compile the C++ code using the compiler that is a part of that suite of tools.

Is your question about how to link an unmanaged DLL into a .NET managed environment using C#? A quick Google search reveals a bunch of different examples of how to combine these components together. Since you seem to have C#, it's likely that you also have Microsoft Visual Studio and you should be able to build this amalgam of C# and C++, managed and unmanaged, without adding the complication of Intel Parallel Studio. I'd recommend that you try to get the basics working first. Once you're happy that those components playing together, it is a simple process to switch from the Microsoft compiler to the Intel Parallel Composer that is part of Intel Parallel Studio. TheParallel Composeris designed to be compatible with the Microsoft C++ compiler so that should be an easy transition, onceyou have the rest ofit working.

I hope this is clear.
0 Kudos
dnesteruk
Beginner
359 Views
Given your later descriptions, I assume that you want to call C++ from C#, and the easiest way to do that is via P/Invoke. There are other options though, like using COM or Microsoft C++/CLI, but P/Invoke is easiest provided you don't need any heavy OOP.
So the idea here is that your C++ DLL would export some functions. Then, if the DLL is put in a location accessible to your C# program, you'd simply declare corresponding methods in a static class as `extern` and decorated with the [DllImport] attribute. Provided you get the signatures right, you'll be able to call from C# into C++ DLLs.
That's all there really is to it.
0 Kudos
Reply