Linking against a Win32-DLL

Bill Baxter dnewsgroup at billbaxter.com
Mon Jul 9 02:42:37 PDT 2007


BLS wrote:
> Marc Müller schrieb:
> 
>>
>> void main(char[][] args)
>> {
>>     writefln("Getting WTInfo...");
>>     int value = WTInfo( 0, 0, null);
>>     writefln("Received WTInfo");
>> }
>> Output:
>> Getting WTInfo...
>> Received WTInfo
>>
>>
>> Everything is fine - but now the same code (I'm just ignoring the 
>> return value of the function):
>>
>>
>> void main(char[][] args)
>> {
>>     writefln("Getting WTInfo...");
>>     WTInfo( 0, 0, null);
>>     writefln("Received WTInfo");
>> }
>>
>> This time the progrbam fails with the following output:
>> Getting WTInfo...
>> Received WTInfo
>> Error: Access Violation
> Hi Marc,
> I suggest to publish the WTInfo() C Header and your D translation, as 
> well as your try block. Otherwise it is a bit difficult to help.
> 
> ...probabely you should start a new thread in D learn. I often got 
> better results using this forum.
> I suppose/guess a WTInfo() return value != 0 says either, feature not 
> available, or something else went wrong. So I think you need the return 
> value anyway ???
> 
> Bjoern

You're saying if you stash the return value it runs fine, otherwise it 
crashes?  That sounds like some kind of messing up of the stack.

Is it possible you're doing extern(C) when you need to be doing 
extern(Window), or vice versa?

I don't have much experience with that so I'm just throwing it out. 
Maybe it just won't link if you get that wrong.

--bb



More information about the Digitalmars-d mailing list