473,511 Members | 13,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing NULL value to a DLL

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
3 5757
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
384
by: J. L. Goddard | last post by:
1) Do c# web methods support default parameters ? 2) Can a web method, or a c# method such as: public nullTest( int i ) { return i++; }
8
4395
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
6
5979
by: MSDNAndi | last post by:
Hi, I get the following warning: "Possibly incorrect assignment to local 'oLockObject' which is the argument to a using or lock statement. The Dispose call or unlocking will happen on the...
6
5563
by: ged | last post by:
Hi, i am a oo (c#) programmer, and have not used javascript for a while and i cant work out how javascript manages its references. Object References work for simple stuff, but once i have an...
2
1599
by: Simon Harvey | last post by:
Hi everyone, I'm having a really simple problem - I can't seem to insert a null value into the database. When I do it tells me that the procedure expects the parameter and that I'm not providing...
12
2662
by: Andrew Bullock | last post by:
Hi, I have two classes, A and B, B takes an A as an argument in its constructor: A a1 = new A(); B b = new B(a1);
12
5367
by: Mike | last post by:
Consider the following code: """ struct person { char *name; int age; }; typedef struct person* StructType;
7
3290
by: TS | last post by:
I was under the assumption that if you pass an object as a param to a method and inside that method this object is changed, the object will stay changed when returned from the method because the...
3
2387
by: DaTurk | last post by:
If I call this method, and pass it a byte by ref, and initialize another byte array, set the original equal to it, and then null the reference, why is the original byte array not null as well? I...
13
4703
by: seaside | last post by:
I have a method function appendChildNode( AST $aNewChild ) { ... } <<< where AST is a class. If I pass null, PHP renders this message: Catchable fatal error: Argument 1 passed to...
0
7144
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
7356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7427
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
7512
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
5671
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5069
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...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
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 ...
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.