473,414 Members | 1,729 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,414 software developers and data experts.

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.InteropServices.MarshalDirectiveEx ception' 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 2050
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.google.co m...
Concerning marshalling of unmanaged data types from and to a
C-library, what does this error mean?
"An unhandled exception of type
'System.Runtime.InteropServices.MarshalDirectiveEx ception' 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_Initialise( 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_Initialise")]public
static extern int InitializeRegistry([MarshalAs(UnmanagedType.AsAny)]UIntPtr
LDAPSession,[MarshalAs(UnmanagedType.LPStr)]string
HostPort,[MarshalAs(UnmanagedType.LPStr)]string
AdminUserID,[MarshalAs(UnmanagedType.LPStr)]string AdminPassword);

and the actual call is:

UIntPtr LDAPSession=UIntPtr.Zero;
int ret=UML.InitializeRegistry(LDAPSession,"blabla","b labla","blabla");
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
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...
1
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...
4
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
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...
3
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. ...
6
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. ...
1
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...
0
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. ...
2
by: wizofaus | last post by:
Given the following code: public class Test { static unsafe void StringManip(string data) { fixed (char* ps = data) ps = '$'; }
2
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.