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

Passing NULL value to a DLL

P: n/a
I have a DLL written in C++ and I'm calling it from C#

One of the parameters for a function in the DLL is a DATE value or NULL.

How do I pass NULL to my DLL from C#?

--
Michael Tissington
Oaklodge Technologies
http://www.oaklodge.com/technology

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Then how do I pass it as a DateTime OR null

--
Michael Tissington
Oaklodge Technologies
http://www.oaklodge.com/technology

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:u4**************@TK2MSFTNGP10.phx.gbl...
Michael,
How do I pass NULL to my DLL from C#?


Declare it as IntPtr and pass it the value IntPtr.Zero.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.

Nov 13 '05 #2

P: n/a
Michael,
Then how do I pass it as a DateTime OR null


What kind of DLL is it you're working with; managed, COM or a plain
old DLL with exported entry points?

If the latter (i.e. you're using DllImport), just write two overloads,
one where the parameter is an IntPtr and one where its a date.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 13 '05 #3

P: n/a
Hi Michael ,
Could you show me the type of each parameter in the function?

Regards,
WL

"Michael Tissington" <mi*****@nospam.com> wrote in message
news:uG**************@TK2MSFTNGP11.phx.gbl...
Then how do I pass it as a DateTime OR null

--
Michael Tissington
Oaklodge Technologies
http://www.oaklodge.com/technology

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:u4**************@TK2MSFTNGP10.phx.gbl...
Michael,
How do I pass NULL to my DLL from C#?


Declare it as IntPtr and pass it the value IntPtr.Zero.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.


Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.