From: Craig Powers on 29 Mar 2010 12:02 Arjen Markus wrote: > On 29 mrt, 10:33, Gib Bogle <g.bo...(a)auckland.no.spam.ac.nz> wrote: >> Gib Bogle wrote: >>> !DEC$ ATTRIBUTES STDCALL, REFERENCE, MIXED_STR_LEN_ARG, ALIAS:"EXECUTE" >> Replacing STDCALL by C makes this work. C++ apparently has a different calling >> convention than Python, which needs STDCALL. > > This really depends on the compiler used. > > STDCALL ordinarily does more than just change the calling > convention - it also adds a suffix "@nn" to the link name of > the routines (where nn is the number of bytes in the interface). > Via aliases that may become invisible. That's not really an issue here, though. The ALIAS attribute on the Fortran side avoids the stdcall name mangling. The part that really matters is the difference in calling convention.
From: Gib Bogle on 29 Mar 2010 18:23 Jugoslav Dujic wrote: > Gib Bogle wrote: >> Gib Bogle wrote: >> >>> !DEC$ ATTRIBUTES STDCALL, REFERENCE, MIXED_STR_LEN_ARG, ALIAS:"EXECUTE" >> >> Replacing STDCALL by C makes this work. C++ apparently has a >> different calling convention than Python, which needs STDCALL. > > I suppose you've just found the reason why that calling convention is > called "C" :-). :-) What misled me to expect the behaviour with Python to be the same as that with C++/Qt is that I'm using PyQt - but of course the windll.LoadLibrary facility is straight Python, with no Qt involvement. It's all so confusing ... But I'm very proud of myself for having almost completely translated my Python/PyQt GUI code into C++/Qt - a crash course in C++. C++ is both wonderful and horrible. The power of the object approach is obvious, but the complexity is daunting. I must say I've come to have great respect for the standardized documentation of the classes that Qt provides, but life in the Fortran world is so much simpler. There is absolutely no doubt in my mind that C++ is the obvious language to use for the kind of stuff that Qt does. I wouldn't want to develop my model with it, though.
From: Gib Bogle on 29 Mar 2010 18:24 Craig Powers wrote: > Gib Bogle wrote: >> Gib Bogle wrote: >> >>> !DEC$ ATTRIBUTES STDCALL, REFERENCE, MIXED_STR_LEN_ARG, ALIAS:"EXECUTE" >> >> Replacing STDCALL by C makes this work. C++ apparently has a >> different calling convention than Python, which needs STDCALL. > > Alternatively, slap a "__stdcall" on your function pointer type---the > default, as you discovered, is __cdecl. It may also need to be 'extern > "C"'; I don't recall offhand whether that has any impact beyond name > mangling to where it would be needed here. Thanks, I'll try that.
First
|
Prev
|
Pages: 1 2 Prev: Does PAUSE have any Side Effect ?? Next: Fortran 95 equivalent of read(..., POS=...) |