473,546 Members | 2,249 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tivoli C library and unsafe C# (a void** problem)

Concerning marshalling of unmanaged data types from and to a
C-library, what does this error mean?
"An unhandled exception of type
'System.Runtime .InteropService s.MarshalDirect iveException' occurred in
TivoliUML.exe

Additional information: Can not marshal parameter #1: Invalid
managed/unmanaged type combination (Int/UInt must be paired with I or
U)."

Thank you for any help!
Nov 15 '05 #1
2 2055
Francois, what does your p/invoke statement look like? That exception
usually means you are trying to use an unsupported MarshalAs attribute.

--
Greg Ewing [MVP]
http://www.citidc.com

"Francois Vanderseypen" <ne***********@ hotmail.com> wrote in message
news:40******** *************** **@posting.goog le.com...
Concerning marshalling of unmanaged data types from and to a
C-library, what does this error mean?
"An unhandled exception of type
'System.Runtime .InteropService s.MarshalDirect iveException' occurred in
TivoliUML.exe

Additional information: Can not marshal parameter #1: Invalid
managed/unmanaged type combination (Int/UInt must be paired with I or
U)."

Thank you for any help!

Nov 15 '05 #2
Hi Greg,

I posted a more detailed message earlier but basically I have the following:

The C-lib signature is:

int SIT_Registry_In itialise( void ** _LdapSession ,
char* _szHost_Port,
char* _szAdmin_DN,
char* _szAdmin_Pwd);

I understand that the void** is a "byref" argument. The _LdapSession
is passed (as a connection object) to other calls thereafter. I guess
the _LdapSession is a C-structure.

How should I wrap this dll function?

At this moment it looks like:

[DllImport("SIT_ UML.dll", EntryPoint="SIT _Registry_Initi alise")]public
static extern int InitializeRegis try([MarshalAs(Unman agedType.AsAny)]UIntPtr
LDAPSession,[MarshalAs(Unman agedType.LPStr)]string
HostPort,[MarshalAs(Unman agedType.LPStr)]string
AdminUserID,[MarshalAs(Unman agedType.LPStr)]string AdminPassword);

and the actual call is:

UIntPtr LDAPSession=UIn tPtr.Zero;
int ret=UML.Initial izeRegistry(LDA PSession,"blabl a","blabla","bl abla");
Thanks for your help!
Nov 15 '05 #3

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

Similar topics

1
1766
by: Francois Vanderseypen | last post by:
Context: C# wrapper around Tivoli LDAP C library. I understand that something like "public static unsafe void init(void** LDAPObj)" has to do with a byref call. Question: How do I have to wrap or call this function?
1
403
by: Francois Vanderseypen | last post by:
I have a C-library API to the Tivoli LDAP allowing to manage users and groups. The user management is an ASP.Net application and this library should update/synchronize the LDAP. The C-lib signature is: int SIT_Registry_Initialise( void ** _LdapSession , char* _szHost_Port, char* _szAdmin_DN,
4
609
by: Jon Milner | last post by:
How do I declare that my code is unsafe? Sorry the help files at my University have not been installed!
2
1590
by: James Dean | last post by:
I cannot access my array of points in unsafe mode....why?.....i can see the values but when i do pointPtr->x then it says it cannot access the values. The pointPtr->X has no value. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
3
2484
by: Stephen Engle | last post by:
I have an app that I am working on that is dependent on an unmanaged code library. There is a middle library of managed C++ that encapsulates the unmanaged libary functions calls into a class. What is happening is that I create an instance of this class in a separate thread and use it to call certain functions. But when I call GC.Collect...
6
2711
by: william.thorpe.b | last post by:
I have recently switched from VS2003 to VS2005 and at the same time from V1 to V2 of the .NET Compact Framework. The target is a Windows CE 5.0 device and an ARMV4I processor. System.Runtime.InteropServices.Marshal.WriteInt32 used to work fine but now is misbehaving. I wrote some native-code (C++) alternates to some Marshal methods and...
1
2465
by: TheSebaster | last post by:
I wrote the following lines of code under Microsoft Visual Studio 2005: I compile my WinCE c++ application importing MyInterop.tlb generated file. The MyInterop.tlh generated file do not contain my interface definition. Does anyone could help me?? (Aditional info) -When I open tlb file with visual studio and I expand MyInterop Library, I...
0
1246
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I have two piece of unsafe code. In the first one I'm getting the byte* pointer of a Bitmap data, and the second one in inside a loop that uses that byte* pointer to set the data in the Bitmap. The trouble is that that each of this pieces of code are bound by a different unsafe section, therefore I'm getting an error that the second unsafe...
2
10038
by: wizofaus | last post by:
Given the following code: public class Test { static unsafe void StringManip(string data) { fixed (char* ps = data) ps = '$'; }
2
1929
by: wmhnq | last post by:
private void button1_Click(object sender, EventArgs e) { unsafe { string str = "abcde"; fixed (char* pStr = str) { A a = new A(pStr); a.change(); MessageBox.Show(str.ToString());
0
7504
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7435
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7792
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.