C # DLLs are registered as Com,delphi to invoke the

Source: Internet
Author: User

Very practical stuff! How many problems can be solved by knowing this method in the past? First build a C # DLL project, write a class//test.cs
Namespace Test
... {
public class MyTest
... {
public string Fun ()
... {
return this. ToString ();
}
}
}, compile and then execute vs vsvars32.bat in CMD to set the environment variable, then execute regasm cscomtest.dll/tlb:cscomtest.tlb/codebase


Microsoft (R). NET Framework Assembly Registration Utility 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

REGASM Warning: Registering unsigned assemblies with/codebase may cause assemblies to interfere with the same computer
Other applications that may be installed on the. The/codebase switch is intended only for signed assemblies. Please for your assembly
Provide a strong name and re-register it.
Type was successfully registered
The Assembly has been exported to C:\Documents and Settings\pyw\my Documents\Visual Studio Proje
Cts\cscomtest\bin\debug\cscomtest.tlb ", type library registration succeeded

Then open VB or VBS, write ko! Success, this effect is equivalent to using VB call C #, although it is implemented through COM, it is cool!

Set o = CreateObject ("Test.mytest")
MsgBox O.fun () http://blog.csdn.net/yanjiaye520/article/details/6777819

C # DLLs are registered as Com,delphi to invoke the

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.