C++/Java function calls from VB.Net

G

Guest

Hi
I have dll from C++ & code in C++. I want to call this functionality from VB. What is the best way

Does .Net has any language/new thing, that can allow to call C++ functions from VB

I also have same code in Java. If I want call functionality from VB, which is better? C++ library(dll) or Java library(jar)

Thank you
Avin Patel
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?QXZpbiBQYXRlbA==?= said:
I have dll from C++ & code in C++. I want to call this functionality from VB. What is the best way?

Does .Net has any language/new thing, that can allow to call C++ functions from VB?

You can export the functions from your C DLL and use them with
'DllImportAttribute' or 'Declare' in VB.NET. If it's a C++ class
library, you can use the classes/methods by making it a COM DLL.
I also have same code in Java. If I want call functionality from VB, which is better? C++ library(dll) or Java library(jar).

C++.
 
G

Guest

Hi
This solution was exist before .Net. But doesn't .Net add any better way of doing this

I have searched & found Mixing Language as .Net solution of this problem? Is it correct
Just add _gc in front of C++ code & I would be able to use this class & member variable in VB, Is it correct

I was thinking VB calls from Java code would be better soultion? As both works without memory problem & standard in build types? Isn't it true

Thank you
Avin Patel
 
A

Alex Papadimoulis

Just interop the assembly ...

add a Reference to it in your project (by browsing for COM components) and
it will automagically wrap it for you. You will be able to call methods from
the code like that.

-- Alex Papadimoulis

Avin Patel said:
Hi,
I have dll from C++ & code in C++. I want to call this functionality from VB. What is the best way?

Does .Net has any language/new thing, that can allow to call C++ functions from VB?

I also have same code in Java. If I want call functionality from VB, which
is better? C++ library(dll) or Java library(jar).
 
G

Guest

Hi
If I have class defined C++, Can I be able to use it in VB, by COM components, you have mentioned

I have one C++ class, which handles all memory management & I need to pass this class to all function calls. When I am calling any function in VB, still I will have to pass this class. So Will I be able to use C++ class in VB

Also function calls populated complex data structure, which is present in C++ code. Will I be able to get in VB

Thank you
Avin patel
 
A

Alex Papadimoulis

Avin,

Yes -- just look up Com Interop. You will compile your C++ classes, and they
will appear as regular classes in your VB code.

-- Alex Papadimoulis

Avin Patel said:
Hi,
If I have class defined C++, Can I be able to use it in VB, by COM
components, you have mentioned.
I have one C++ class, which handles all memory management & I need to pass
this class to all function calls. When I am calling any function in VB,
still I will have to pass this class. So Will I be able to use C++ class in
VB.
Also function calls populated complex data structure, which is present in
C++ code. Will I be able to get in VB?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top