ASP.NET unmanaged Code, pure C and session

  • Thread starter Thread starter Joachim
  • Start date Start date
J

Joachim

Hello,

have old C code, that I wan't to use in a ASP.NET application. In this
C Code we use a lot of global and static vairables. For use this old
code in ASP.NET I write a unmanged C++ library.

Now I can use the C code with ASP.NET (C++ ME Wrapper). The problem
is, that all Session now use the same global variables. What I need,
is in each session the global variables from the old C code

For example global C variable <language>
Session 1: french
Session 2: german

Is there a way to solve this problem?

Joachim
 
not without rewriting the old C code. you two copies of the library to have
seperate memory they need to run in seperate processes. if you don't need
many variants of the library, you could start a seperate process for each
one and use remoting to talk to it.

another approch, is to turn the library into a singleton. on each page
request take a lock on the library, restore the static values, call the
library, then copy the static values to session. you could write a utility
that examined the object files or dll to get the static pointers and sizes.


-- bruce (sqlwork.com)
 
Thanks Bruce,

it's not possible to rewrite the C Code. We can't search all the
global and static variables. So we make a COM Exe. So every ASP.NET
Session use this exe in a own process. This works.

Now we wan't to have in this EXE managed C++ with public managed
Classes that we can use from C#. I set the 'Use managed extensions' to
yes in the project configuration. But I don't see the C++ managed
classes from other assemblys when I referenced the EXE. Is it not
possible?


Joachim
 
Back
Top