473,325 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Use unmanaged dll

Hi All!

I have a following problem:

We have a unmanaged dll wrote in C. In this dll we have 2 classes: class Foo
and class Foo_Impl that inherited from Foo. Foo class was created to be
exported from dll, like interface. So, there is a function in the dll,
something like that:

Foo *STDCALL create_foo() {return (new Foo_Impl);}

Now I have a managed code in C# that need use this dll. I made my wrap
managed dll, where I call functions of Foo by entry points, but in spite of
creation Foo_Impl in unmanaged dll, my calls of it's methods arrive into Foo
class!!!

Did anybody solve problem like this? What should I do?
I may change unmanaged dll to export functions by AnsiC. But is is a lot
of changes. It should be another way.

Thanks a lot
Nov 17 '05 #1
1 1855

"Aleksey" <al************@il.quest.com> wrote in message
news:Ox**************@TK2MSFTNGP12.phx.gbl...
Hi All!

I have a following problem:

We have a unmanaged dll wrote in C. In this dll we have 2 classes: class
Foo
and class Foo_Impl that inherited from Foo. Foo class was created to be
exported from dll, like interface. So, there is a function in the dll,
something like that:

Foo *STDCALL create_foo() {return (new Foo_Impl);}

Now I have a managed code in C# that need use this dll. I made my wrap
managed dll, where I call functions of Foo by entry points, but in spite
of
creation Foo_Impl in unmanaged dll, my calls of it's methods arrive into
Foo
class!!!

Did anybody solve problem like this? What should I do?
I may change unmanaged dll to export functions by AnsiC. But is is a lot
of changes. It should be another way.

Thanks a lot


Quite normal, create_foo returns Foo_Impl as a Foo type pointer, if this is
intended, you'll need to cast.....

Foo *ptr = create_foo();
static_cast<Foo_Impl*>(ptr)->Function(...);

Willy.
PS. Note that this is a C# NG, your question is more likely a C++ question,
so you might better post to the VC NG - >
microsoft.public.dotnet.languages.vc

Willy.


Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
2
by: Paul Kenny | last post by:
Hi, I am trying to expose the functionality of an unmanaged C++ class to the other languages available in the .NET Framework. I have decided to do this by wrapping the unmanaged C++ class in a...
4
by: Rachel Suddeth | last post by:
What is the difference between a managed/unmanaged resource, and how do you tell which is which? I'm trying to understand how to write some Dispose() methods, and we are supposed to put code that...
3
by: zhphust | last post by:
I want to convert a object of a managed class to a unmanaged structure that has the same member with that managed class. Can anybody tell me how i can do it? Thanks in advance. -- zhphust...
1
by: Sparhawk | last post by:
Hi, my company is going to migrate a large VC++ application to .NET to make use of Windows Forms (the old class library is not updated any more). We are not planning to migrate the rest of the...
6
by: marek | last post by:
Hello All, we are doing a quite a big project that contains at the lowest level an unmenaged c++ classes. Above it there are managed wrappers and at the top there are ASP.NET pages. Can anyone...
6
by: Stephen Walch | last post by:
Our application environment consists of three basic layers: 1. Third-party unmanaged DLLs that were written before the CLR was invented and maintain a significant amount of information (including...
9
by: Amit Dedhia | last post by:
Hi All I have a VC++ 2005 MFC application with all classes defined as unmanaged classes. I want to write my application data in xml format. Since ADO.NET has buit in functions available for...
5
by: akash | last post by:
I'm having problems calling an unmanaged class from a managed wrapper. I suspect I'm missing something obvious, as I'm unfamiliar with C++ and classes are very simple. My unmanaged class is as...
2
by: Jon Slaughter | last post by:
How difficult is it for one to integrate unmanaged C++ into C#? I know for functions one can use DLLimport but how does one go about doing it for classes? Do I have to completely reimplement the...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.