Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to pass NULL to a DLL function?


2 replies to this topic

jiekang007

jiekang007
  • Members
  • 5 posts

Posted 18 March 2003 - 20:28

Hello,
I have a C++ DLL function declared as:
int functionname(char * str);
This function should be able to receive NULL as the argument.
Here is the prorotype declared in setup.rul:
prototype int MyDLL.functionname(STRING);
However, when I try to pass NULL (which is 0) to it when calling the function, the script won't compile since it's expecting a string instead of a number. Can someone tell me how to do it? I'd reallly appreciate it.

-jiekang007

prozacrefugee

prozacrefugee
  • Members
  • 38 posts

Posted 10 April 2003 - 20:44

Maybe try passing a pointer rather than a string:

POINTER p;

p=NULL;

Then pass it to your function that takes a const char *
foo(p);


prozacrefugee

prozacrefugee
  • Members
  • 38 posts

Posted 14 April 2003 - 19:08

Totally forgot to add this, you'll also need to redefine your function in setup.rul
MYDLL.functionname(BYREF STRING);
or
MYDLL.functionname(POINTER);