MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

char** and uuid_t type issue with DefineDLLFunction

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107433] char** and uuid_t type issue with DefineDLLFunction
  • From: "Jamel Tayeb" <jameltayeb at gmail.com>
  • Date: Fri, 12 Feb 2010 04:44:10 -0500 (EST)

Hi Team,

I have two issues with Mathematica and a function stored in a native dll;
and I would like to have your advice.
I have a DLL with a function f written in C.  The prototype of f is int
f(const char *, unsigned int, const char**, uuid_t *);
I want to use the DefineDLLFunction so I can call f from Mathematica.
I am using the following expression: f = DefineDLLFunction["f", ".\\f.dll",
"int", {"char *", "unsigned int", "char **", "out X*"}]. (I will explain the
X a bit later).  

The first issue I have is the char** type which generates the error below:  
---Begin
Error-----------------------------------------------------------------------
--------------------------------------------
NET::netexcptn: A .NET exception occurred: System.TypeLoadException: Type
System.char** not found.
   at Wolfram.NETLink.TypeLoader.GetType(String typeName, String
assemblyName, Boolean throwOnError)
   at Wolfram.NETLink.Internal.DLLHelper.CreateDLLCall(String funcName,
String dllName, String callConv, String retTypeName, String[] argTypeNames,
Boolean[] areOutParams, String strFormat)
   at Wolfram.NETLink.Internal.CallPacketHandler.createDLL1(KernelLinkImpl
ml).
Out[2]= $Failed
---End
Error-----------------------------------------------------------------------
--------------------------------------------
Indeed, I found no examples of char** type argument in the documentation and
the .NET/LINK user guide.  Can somebody indicate me the type I should use
with DefineDLLFunction for the third argument of f?

The second problem (materialized by the X in the expression presented
earlier) is probably more tricky.  Similarly to char**, I could not find a
reference to a uuid_t type support in Mathematica. FYI, uuid_t is used to
implement Unique Universal Identifiers (RFC 4122).  Since a UUID is a 128
bit data type, is there a way to use UnsignedInteger128 - with some sort of
type cast?  I do not have use of the 128 bits returned by f, but the
function gracefully fails if the pointer is NULL.

Thanks for any help you may provide me,
Merci,
- Jamel



  • Prev by Date: Question about Optional[]
  • Next by Date: Re: Re: Define an antisymmetric function
  • Previous by thread: Re: Question about Optional[]
  • Next by thread: Re: Re: second , third and fourth derivatives of a