0

In my VB6.0 days I used tons of windows API. So I got the idea that all the API methods that I declared are pretty much procedure based - or it has a procedure based entry point.

My question:

I have written some code in C# which I need to access from VB6.0. Is it possible to compile my C# code into a DLL and access that C# DLL from VB6.0 declaring it as an API call? If so, how is this done ?

(I have already tried making my C# DLL COM compliant, and it worked - but I would like to try the above mentioned approach anyway)

1
  • 1
    Is there any particular reason why you don't want to make the C# DLL COM compliant? Commented May 1, 2009 at 13:06

2 Answers 2

4

No, you can't expose the entry points to your C# DLL as Win32-style APIs. If you really, really need to create procedural entry points for a .NET library, probably the best thing to do is create a mixed-mode wrapper library using C++/CLI. But this seems like hard work: exposing your C# classes as COM objects is likely to be a lot less effort and much easier to maintain.

Sign up to request clarification or add additional context in comments.

Comments

0

If you're happy to get your hands (very) dirty, you can do what you want by using MSIL. Have a look at this CodeProject project for a walkthrough.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.