June 02, 2014 Multi-file project problem with Visual D | ||||
---|---|---|---|---|
| ||||
I've created a small Windows based program using a win32 library I found online. That part is working just fine. I've also created a second file (called util.d) and within it defined a class called MyData (with a member function called Read()). Within my main program I instantiate and try to call the Read() method. No errors are generated but nothing gets called. Right now the Read() method just does a throw so I know something is going on. What am I missing here? I would think the compiler would generate an error if something was missing. winmain.d: --------------------------------- extern(Windows) LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CREATE: f.Read() ; return 0 ; /* ... */ } // WndProc util.d: ---------------------------------- class MyData { public: void Read() { throw new Exception("No!", __FILE__, __LINE__) ; } // void Read() } // class Data |
June 02, 2014 Re: Multi-file project problem with Visual D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike | On Monday, 2 June 2014 at 01:01:22 UTC, Mike wrote:
> I've created a small Windows based program using a win32 library I found online. That part is working just fine.
>
> I've also created a second file (called util.d) and within it defined a class called MyData (with a member function called Read()).
>
> Within my main program I instantiate and try to call the Read() method. No errors are generated but nothing gets called. Right now the Read() method just does a throw so I know something is going on.
>
> What am I missing here? I would think the compiler would generate an error if something was missing.
>
> winmain.d:
> ---------------------------------
> extern(Windows)
> LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
> {
>
> switch (message)
> {
> case WM_CREATE:
> f.Read() ;
> return 0 ;
>
> /* ... */
>
> } // WndProc
>
>
>
> util.d:
> ----------------------------------
>
> class MyData {
> public:
> void Read() {
> throw new Exception("No!", __FILE__, __LINE__) ;
> } // void Read()
> } // class Data
Doing more testing and debugging found that the value of the instance is 0, which leads me to believe something is happening with the instantiation. Back to the books I suppose.
|
Copyright © 1999-2021 by the D Language Foundation