By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,402 Members | 1,262 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,402 IT Pros & Developers. It's quick & easy.

Interface to C++ (unmanaged) DLL and std::string or std::wstring

P: n/a
Hallo NG,

i can call functions from a native C++-dll wich uses "const char *" as
stringtype via P/Invoke without problems. Is there an easy way to call
functions that uses std::string or std:wstring in the function call ?

Has someone a tiny example how to access such a DLL with an
IJW-Interface ?
Thanx in advance,

Howie
Nov 3 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"Howie Meier" <howieh@_web.dewrote in message
news:r3********************************@4ax.com...
| Hallo NG,
|
| i can call functions from a native C++-dll wich uses "const char *" as
| stringtype via P/Invoke without problems. Is there an easy way to call
| functions that uses std::string or std:wstring in the function call ?
|

You can't pass such kind of objects using PInvoke. PInvoke only deals with C
style functions and argument types.
| Has someone a tiny example how to access such a DLL with an
| IJW-Interface ?
|

IJW is a MC/C++ term and has nothing to do with C#, the only way to interop
with C/C++ is through PInvoke.

Willy.
Nov 3 '06 #2

P: n/a
On Fri, 3 Nov 2006 10:16:54 +0100, "Willy Denoyette [MVP]"
<wi*************@telenet.bewrote:

Thanks Willy
>| Has someone a tiny example how to access such a DLL with an
| IJW-Interface ?
|

IJW is a MC/C++ term and has nothing to do with C#, the only way to interop
with C/C++ is through PInvoke.
You are wrong. It means "It Just Works" and is the way to make a C++
DLL with managed and unmanaged Code together. The C# will only need to
access the C++ managed level.

Howie

Nov 3 '06 #3

P: n/a

"Howie Meier" <howieh@_web.dewrote in message
news:qd********************************@4ax.com...
| On Fri, 3 Nov 2006 10:16:54 +0100, "Willy Denoyette [MVP]"
| <wi*************@telenet.bewrote:
|
| Thanks Willy
|
| >| Has someone a tiny example how to access such a DLL with an
| >| IJW-Interface ?
| >|
| >
| >IJW is a MC/C++ term and has nothing to do with C#, the only way to
interop
| >with C/C++ is through PInvoke.
| >
| You are wrong. It means "It Just Works" and is the way to make a C++
| DLL with managed and unmanaged Code together. The C# will only need to
| access the C++ managed level.
Sorry, but I'm right, C# doesn't have a notion of IJW, it's an "interop
layer" provided by the MC++ compiler to mixed mode C++ (/clr compiler flag)
it's not applicable to C# nor is it part of the CLR. Sure you can access
managed C++ from C#, both use the same object model, but you can't use C# to
access unmanaged C++ in a IJW fashion like MC++ is doing. Note also that the
term IJW is no longer used for C++/CLI, now it's called "C++ interop".

Willy.

Nov 3 '06 #4

P: n/a
On Fri, 3 Nov 2006 12:42:22 +0100, "Willy Denoyette [MVP]"
<wi*************@telenet.bewrote:

>Sorry, but I'm right, C# doesn't have a notion of IJW, it's an "interop
layer" provided by the MC++ compiler to mixed mode C++ (/clr compiler flag)
it's not applicable to C# nor is it part of the CLR. Sure you can access
managed C++ from C#, both use the same object model, but you can't use C# to
access unmanaged C++ in a IJW fashion like MC++ is doing. Note also that the
term IJW is no longer used for C++/CLI, now it's called "C++ interop".
Excuse me Willy, you are right, i have read MFC not MC.

Thanks.

Howie
Nov 3 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.