Re: Calling dll function causes program to end

new topic     » goto parent     » topic index » view thread      » older message » newer message
ryanj said...

Ah, i forgot i also had to do this:

callbackaddr = call_back({'+', streamCallback})

Now it runs. I still don't hear audio, though. Another interesting thing i discovered: if i call task_yield() while the audio stream is running, it dies with no error. I'm curious what task_yield() does that would cause problems with a callback.

Most DLLs aside from the ones provided by Windows will probably use cdecl. That's generally the default for C compilers.

On Windows, tasks are implemented using Fibers, which are cooperative multitasking constructs for Windows. They're actually quite analogous to euphoria's tasks. Odd things can happen if you mix these with treads. If we eventually get true multi-threading, I think we'll have to switch to using threads for euphoria tasks (which we already do on non-Windows platforms).

We no longer to any low level manipulation of the stack (which was really only done for translated code). Current operating systems thwart this sort of thing as it looks like stack smashing or something similarly malicious.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu