Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

We are working on a .NET project (VB.net). We have a situation in our project where we need to access a C code from our .NET application. We are looking for some help on how to do that. We need to access the C code from the VB.net programs. We are looking for some help on creating a COM component from VC++ by accessing the C code. We do have some theoretical knowledge in this regard, but not able to do it. Some samples would be a great help in this regard.

 

Thanks in advance

Oursmp

Posted

Once you correctly create your COM component, it is rather easy to access it via VB.Net. Trivial even.

 

Creating a COM component is usually done with either VB 6.0 or with C++. Since your original code is C, then C++ is the right way to go... However, I don't have any (personal) knowledge about how to use C++ and this really isn't the right site for how to do this...

 

I would try Google on terms like "Creating COM with C++" or the like and/or look into C++ and VC++ oriented forums and websites. I'm not trying to throw you away! I wish I knew how to do this, but I don't have any C++ experience myself, and this really isn't the right forum for it.

 

Another thought is that you don't have to make a COM DLL, actually. You can make a regular DLL and access it from VB.Net by using the Declare Statement or the <DLLImport()> Attribute. Each Function and Sub that you intend to use would have to be imported individually this way, so is fine if you have only a few, but could be tedious if you have dozens of them. So if you have a lot of functions that you are going to be using this way, then, yeah, making it into a COM DLL would probably be best.

 

I just don't know how to do this from C++. :(

 

Sorry couldn't do better,

Mike

Posting Guidelines

 

Avatar by Lebb

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...