What is wrong with this boilerplate mixin? (0/1)

Carlos Santander csantander619 at gmail.com
Mon Oct 23 15:44:24 PDT 2006


Max Samuha escribió:
> On Mon, 23 Oct 2006 07:54:30 -0500, Carlos Santander
> <csantander619 at gmail.com> wrote:
> 
>> AF escribio:
>>> Hello,
>>>
>>>  To make Win programming simpler, I divided sample application
>>> (winsample.d) in a standard module (modwin.d) containing the
>>> boilerplate code, and a application (appwin.d) file.
>>>  Both files resides in the same directory.
>>>  However, it does not link:
>>>
>>>  D:\temp\dlang5>dmd appwin.d
>>> c:\dmd\bin\..\..\dm\bin\link.exe appwin,,,user32+kernel32/noi;
>>> OPTLINK (R) for Win32  Release 7.50B1
>>> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
>>>
>>> c:\dm\bin\..\lib\SNN.lib(winstart)
>>>  Error 42: Symbol Undefined _WinMain at 16
>>>
>>>  So, what to do? And, 2nd, could things be made simpler? Attached
>>> are modwin.d and appwin.d.
>> D:\temp\dlang5>dmd appwin.d modwin.d
> 
> Oops. I didn't notice that the second file was not included.
> 
> Anyway, even if you include the file, the definition of WinMain will
> not be found because of mangling. I attached the code that uses a
> function pointer (i called it delegate mistakingly). 

I don't use Windows, so I can't test your code, but I think it should work. Why 
don't you try going from the beginning? Just a simple module with a WinMain, see 
if it works. Then try to use the function pointer from within the same module, 
see if it works. And then split it. Good luck.

-- 
Carlos Santander Bernal



More information about the Digitalmars-d-learn mailing list