468,504 Members | 1,956 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,504 developers. It's quick & easy.

C++/Java function calls from VB.Net

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
Nov 20 '05 #1
5 2610
* "=?Utf-8?B?QXZpbiBQYXRlbA==?=" <an*******@discussions.microsoft.com> scripsit:
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++.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
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
Nov 20 '05 #3
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" <an*******@discussions.microsoft.com> wrote in message
news:5E**********************************@microsof t.com...
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

Nov 20 '05 #4
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
Nov 20 '05 #5
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" <an*******@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com...
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

Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

73 posts views Thread by RobertMaas | last post: by
10 posts views Thread by Alex Gerdemann | last post: by
6 posts views Thread by Rhino | last post: by
458 posts views Thread by wellstone9912 | last post: by
2 posts views Thread by ramasubramanian.rahul | last post: by
3 posts views Thread by gieforce | last post: by
reply views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.