typesafe Variadic Parameter in DLLs

Bjoern nanali at nospam-wanadoo.fr
Fri Feb 8 07:58:53 PST 2008


Hi,
I hope that I can write a small utility DLL which offers support for :

BinaryOrPlus(WS_TABSTOP | WS_CHILD | WS_CLIPSIBLINGS)

Why ? Because my 4GL don't have a binary OR operator (just a function) 
so this code fragment will not work :

WS_TABSTOP | WS_CHILD | WS_CLIPSIBLINGS    // etc.

Instead I have to use :
(BinaryOr(BinaryOr(WS_TABSTOP | WS_CHILD), WS_CLIPSIBLINGS)  // stinks !

I hope it is possible to create something similar to :

export extern (Windows) uint BinaryOrPlus(uint...)
{
   uint result = _arguments[0];
   for (int i = 1; i < _arguments.length; i++)
   {
      result |= _arguments[i];
   }
   return result;
}

Unfortunately Error msg is :

C:\dmd\projects\bsdutil>dmd -profile -odc:\dmd\projects\bsdutil\obj 
-ofBSDUTIL.D
LL bsdutil.d demangle.d bsdutil.def
bsdutil.d(110): Error: undefined identifier _arguments
bsdutil.d(110): Error: _arguments must be an array or pointer type, not int

etc. I use Tango.
??????
Bjoern





More information about the Digitalmars-d-learn mailing list