Link to home
Start Free TrialLog in
Avatar of derekthornton
derekthornton

asked on

malloc C# Equal?

I've got a C++ 6.0 Statement...
TOCRResults = (TOCRRESULTS *)malloc(ResultsInf);

I'm needing to (A) figure out what in the world this is even doing ..I believe it is allocating the amount of bytes to TOCRResults that ResultsInf needs...
and ..(B) what would be the C# Equivalent? Thanks for your time.
ASKER CERTIFIED SOLUTION
Avatar of stone123
stone123

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of _TAD_
_TAD_



Bummer!  Beaten by mere seconds (with more or less the same repsponse, although stone's is a bit more concise).

oh well...
Avatar of derekthornton

ASKER

I know C# Doesn't like pointers, and frankly, neither do I, however the first post was correct, it is a commercial library I have purchased and am trying to port to C#. It is an OCR Engine. This TOCRResults structure is supposed to hold the Results of an OCR Job, but it's just plain not working and I'm getting VERY frustrated. I've already gotten help with other parts of this project, and am starting to wonder if a full port to C# is even possible....
Question Answered - Problem still there, but I did get the answer to the malloc question. If anyone else wants to take a crack at this feel free to ask, It's driving me crazy.
Thanks for the points, derekthornton.

When you say OCR, do you mean Optical Character Recognition? Just for curiosity.

why do you want to port it to C#? Is there any particular reason? Personally, I suggest you just use your Visual Studio.NET to create a Managed C++ class library project. And you shouldn't make much change to port it to Managed C++ project, which is also based and runs on .NET framework.

Then there are a few ways to easily call functions and create instances of library classes from a separate C# program. If you are interested, i will write to you more.

Good luck
I want to write the whole thing in C#. I don't own Visual Studio .NET either, just the individual "Standard" Products. Furthermore, the code I have is pretty unflexible, and I don't like the style the library I bought was coded in. I cannot make it a managed C++ Class Library, because I cannot access the actual 'Source' just the API, so I am stuck with what I have, and calling a C++ .dll from C# is just not something I like to do, it is Very sloppy, in my opinion, and it just never works how I like it to, so I want to rewrite it entirely. And yes, It is an Optical Character Recognition program. I can send you the Solution if you want to see it.
But if I can just make it an easy to use .dll file, that would work. The problem is that it never wants to load correctly in C# when I try to make a .dll in C++.
well!
Windows system 32 bit dlls or COM dlls or any kind of dlls, all can be called in .NET framework's any language, just use the interopabilities of the .Net framework, Search in the MSDN