Board index » Visual Studio » Use a .Net Dll into a VC++ programme

Use a .Net Dll into a VC++ programme

Visual Studio3
Hi,



I developed a VC++ project

Now, i need to use/import/add a .Net Dll into the VC++ Project.

How do this?



Thanks


-
 

Re:Use a .Net Dll into a VC++ programme

"*sol*" <soisfife@gmail.com>wrote in message

Quote
I developed a VC++ project

Now, i need to use/import/add a .Net Dll into the VC++ Project.

How do this?



One way is to "register" the .Net assembly so that its classes appear to the

native code as COM objects. I sketch the procedure in a trivial sample here:



groups.google.com/group/microsoft.public.dotnet.languages.vc/browse_frm/thread/a9ecd6619283dca9/8b7cc21dc2b67f3d&q=&rnum=1&hl=en#8b7cc21dc2b67f3d">groups.google.com/group/microsoft.public.dotnet.languages.vc/browse_frm/thread/a9ecd6619283dca9/8b7cc21dc2b67f3d&q=&rnum=1&hl=en#8b7cc21dc2b67f3d



Just by the way, more .Net related questions seem to get posted and answered

in the newsgroup:



microsoft.public.dotnet.languages.vc



than this one.



Regards,

Will





-

Re:Use a .Net Dll into a VC++ programme

This is a multi-part message in MIME format.



------=_NextPart_000_0045_01C714F5.30BE0110

Content-Type: text/plain;

charset="utf-8"

Content-Transfer-Encoding: quoted-printable



Hi sol,



It's very simple, you can use TLBIMP to import .Net assembly to a tlb =

type library file.=20

tlbimp <assembly.dll>/out: <tlb file>.tlb

After that, you could use #import <.tlb>to use that library. Just it...

"*sol*" <soisfife@gmail.com>=E5=86=99=E5=85=A5=E6=B6=88=E6=81=AF =

Hi,



I developed a VC++ project

Now, i need to use/import/add a .Net Dll into the VC++ Project.

How do this?



Thanks



------=_NextPart_000_0045_01C714F5.30BE0110

Content-Type: text/html;

charset="utf-8"

Content-Transfer-Encoding: quoted-printable



=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD>

<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8">

<META content=3D"MSHTML 6.00.5730.11" name=3DGENERATOR>

<STYLE></STYLE>

</HEAD>

<BODY bgColor=3D#ffffff>

<DIV><FONT face=3D"Times New Roman">Hi sol,</FONT></DIV>

<DIV><FONT face=3D"Times New Roman" size=3D4></FONT>&nbsp;</DIV>

<DIV><FONT face=3D"Times New Roman">It's very simple, you can use =

TLBIMP&nbsp;to=20

import .Net assembly to a tlb type library file. </FONT></DIV>

<DIV><FONT face=3D"Times New Roman">tlbimp &lt;assembly.dll&gt; /out: =

&lt;tlb=20

file&gt;.tlb</FONT></DIV>

<DIV><FONT face=3D"Times New Roman">After that, you could use #import =

&lt;.tlb&gt;=20

to use that library. Just it...</FONT></DIV>

<BLOCKQUOTE=20

style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =

BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

<DIV>"*sol*" &lt;<A=20

href=3D"mailto:soisfife@gmail.com">soisfife@gmail.com</A>&gt; =

=E5=86=99=E5=85=A5=E6=B6=88=E6=81=AF <A=20

=

href=3D"news:1164896968.506095.251500@n67g2000cwd.googlegroups.com">news:=

1164896968.506095.251500@n67g2000cwd.googlegroups.com</A>...</DIV>Hi,<BR>=

<BR>I=20

developed a VC++ project<BR>Now, i need to use/import/add a .Net Dll =

into the=20

VC++ Project.<BR>How do =

this?<BR><BR>Thanks<BR></BLOCKQUOTE></BODY></HTML>



------=_NextPart_000_0045_01C714F5.30BE0110--



-

Re:Use a .Net Dll into a VC++ programme

"Lyle Avery" wrote:

Quote
It's very simple, you can use TLBIMP to import .Net

assembly to a tlb type library file.

tlbimp <assembly.dll>/out: <tlb file>.tlb

After that, you could use #import <.tlb>to use that

library. Just it...



I think you're wong. Tlbimp tool does exactly the opposite:

it takes TLB (or a file, which contains it) as an input and

produces .NET assembly as an output. See for reference:



"Type Library Importer (Tlbimp.exe)"

msdn2.microsoft.com/en-us/library/tt0cf3sx(VS.80).aspx">msdn2.microsoft.com/en-us/library/tt0cf3sx(VS.80).aspx



Probably you confused it with Tlbexp tool, which makes TLB

from an .NET assembly:



"Type Library Exporter (Tlbexp.exe)"

msdn2.microsoft.com/en-us/library/hfzzah2c(VS.80).aspx">msdn2.microsoft.com/en-us/library/hfzzah2c(VS.80).aspx



Alex



-