Windows API Translation

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Mon Feb 7 23:52:24 PST 2011


On Tue, 08 Feb 2011 09:36:54 +0200, Vladimir Panteleev wrote:

> On Tue, 08 Feb 2011 09:10:02 +0200, Andrew Wiley <debio264 at gmail.com>
> wrote:
> 
>> I'm trying to use the Windows file change notification API from D, and
>> I'm having trouble translating Microsoft's macro-laden signatures into
>> D. I thought I had it figured out, but optlink says otherwise: The
>> original function is this:
>>
>> HANDLE WINAPI FindFirstChangeNotification(
>>   __in  LPCTSTR lpPathName,
>>   __in  BOOL bWatchSubtree,
>>   __in  DWORD dwNotifyFilter
>> );
>>
>> I translated it into:
>>
>> extern(Windows) {
>> uint FindFirstChangeNotification(
>> 	const(char)* lpPathName,
>> 	bool bWatchSubtree,
>> 	uint dwNotifyFilter
>> );
>> }
>>
>> Optlink is giving me undefined symbol errors, but I can't seem to
>> figure out what I have wrong. Any help would be appreciated.
> 
> Are you linking with the appropriate import library?
> 
> You may also want to have a look at the Win32 bindings project (which
> also has this function among many others):
> http://dsource.org/projects/bindings/wiki/WindowsApi

Wow, I didn't know this existed.  I wonder if these bindings would be 
suitable for inclusion in the core.sys.windows package?  Currently, 
core.sys.windows.windows only contains a small subset of the Windows API.

-Lars


More information about the Digitalmars-d mailing list