Johnnie
Johnnie

Reputation: 87

How to export c# function so it can be called from unmanaged environment?

I would like to know how can I export a function so I can use it in other programming language?

I want to use the dll functions in unmanaged programming language.

What can I do?

Upvotes: 2

Views: 194

Answers (2)

Steve Danner
Steve Danner

Reputation: 22168

You will need to run regasm.exe with the /tlb command against your .NET assembly and then reference the output type library (tlb) from C++.

I've done this many times before and it can be a pain, especially when you go to deploy it. I recommend using the /codebase switch, which tells the registry where to find your .NET assembly when its classes are instantiated in a COM context. That makes it easy to find in the registry and tweek it as necessary.

Upvotes: 2

Jeff B
Jeff B

Reputation: 9002

Two articles that may be of use... it sounds rather painful:

Upvotes: 2

Related Questions