Good work - For the most part Interop is not for the faint of heart..;)  Now try it 
with a legacy C application!

FV

-----Original Message-----
From: Sam Gentile [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 12, 2002 8:05 AM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Exporting C# methods to unmanaged world...


I just did this. I took my .NET assemblies and made a COM Interop CCW
and then used the CCW to call through it from unmanaged code through
COM. The steps are in Adam Nathan's most excellent book but basically
something like this:


1) Create the .NET class
2) Generate a key for it - sn -k keyfile.snk
3) Put in the assembly directive for the key *can't remember from memory
and 1/2 asleep right now) something like [(Assembly:
AssemblyKeyFile("keyfile.snk")] at top of file
4) Compile
5) regasm file.dll /tlb
6) gacutil -I file.dll
7) copy generated tlb into MC++ code directory
8) In MC++ file: #import file.tlb no_namespaces named_guids and one
other I can't remember
9) Compile C++ code and you will have access to the CCW through the
types in the imported tlb

Adam has it explained neater in his book-) I haven't had my coffee yet
-)


Sam Gentile
Co-Author Wrox Professional Visual C++.NET (ISBN 1861005962 )

[EMAIL PROTECTED]
www.project-inspiration.com/sgentile
http://www.project-inspiration.com/sgentile/DotNet.htm
BLOG: http://radio.weblogs.com/0105852/
http://www.project-inspiration.com/sgentile/ScienceFiction.htm
 
 
 
 

-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of
Thomas Tomiczek
Sent: Friday, April 12, 2002 4:35 AM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Exporting C# methods to unmanaged world...

Normal - ys, via COM.

Static - no.


Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)



-----Original Message-----
From: José M. Nobre [mailto:[EMAIL PROTECTED]] 
Sent: Freitag, 12. April 2002 10:02
To: [EMAIL PROTECTED]
Subject: [DOTNET] Exporting C# methods to unmanaged world...


Hi...
Is there a way to export C# methods (probably, static method...)
directly to the unmanaged world ? I mean... something like the old
extern "C" from C++ ?

My current solution is to have another DLL written in C++ that calls my
assembly... :/

thanks in advance
jmn

--
    ^ ^
   (o o)    José Manuel Nobre
  (( v ))
----x-x-----------------------------------------------------------------
----
PragmaSis - Sistemas de Informação, SA
Pc. de Alvalade, 6 - 2 A2
1700 - 036 Lisboa
Portugal

Tel. +351 217 827 547
Fax. +351 217 961 803

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to