Only through round-tripping. ILDASM your EXE/DLL to .IL file, then edit the .IL file 
the following way (<N> is the number of methods you want to export):

1) Before all class definitions add declarations:
        .vtfixup [<N>] int32 fromunmanaged at VTF01
        .data VTF01 = int32(0)[<N>]

2) Within the method scope (inside the curly braces) of every method you want to 
export add declarations (<M> is the export ordinal, usually 1-based):
        .vtentry 1:<M>
        .export [<M>] as <ExportAlias>

<ExportAlias> may or may not be the same as the method's name.

After you edited the .IL file, ILASM it.

Thanks,
Serge
 

-----Original Message-----
From: Jose M. Nobre [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 12, 2002 1:02 AM
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.

Reply via email to