Best Method for using other languages in C#

G

Guest

So, I am writing an application in C#, and I have some old C code that I want
to use. Now, i tried to convert it to a DLL, and while I easily got it
working, it didn't work like it was supposed to. The problem, is that there
are global structures, with values that change as you write to certain
functions.

To be less vague, the C code is an old FM Chip emulator, so most of the
structures' values have to be stored in memory, as I make calls to change
them. Then I render the sound wave, based on the structure's values, with
another function call. The DLL idea didn't work, because it's making
seperate calls to the functions, and all data used is reset each call.

So, with DLLs out of the question, I'm asking for people's opinions on what
would be the best way to use the code in C#. I was considering converting it
to managed C, and using multiple file assemblies, but I'm unsure if it would
keep the data in memory between calls.

Any ideas are appreciated.

Thanks
 
G

Guest

If you're using Visual C++ 2005 you can simply create a C++/CLI project and
add all the C/C++ files to the project. You can then simply create managed
C++ classes that access these C/C++ functions/classes to provide a managed
wrapper... This is called C++ Interop. With Visual C++ 2003 a similar thing
was called IJW or "It just works".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top