Windows parameter

Simen Kjaeraas simen.kjaras at gmail.com
Sun Jun 30 11:52:52 PDT 2013


On Sun, 30 Jun 2013 20:24:17 +0200, shuji <cravstar at hotmail.com> wrote:


> int setHWND(HWND extHwnd){
> 	hwnd = extHwnd;
> 	return 0;
> }
And:

> extern (C++) {
> 	int setHWND(HWND hwnd);
> }


See how these are different? One of them is an extern (C++) function, the  
other is a D function.

In other words, this should work:

//funcs.lib
//windows includes...
HWND hwnd;
extern (C++) { // This line!
int setHWND(HWND extHwnd){
	hwnd = extHwnd;
	return 0;
}
}

//main.d
pragma(lib, "gdi32.lib");
import core.runtime;
import core.sys.windows.windows;
extern (C++) {
	int setHWND(HWND hwnd);
}
int main(int argc, char **argv) {
//windows initializers
	setHWND(hwnd);
	return 0;
}



-- 
Simen


More information about the Digitalmars-d-learn mailing list