Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / GlobStruct...is there any other simple way? (almost offtopic)

Author
Message
Three Score
19
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 10th Mar 2007 06:48
I have made a 8086 emulator, it uses external devices in the form of DLLs(or SOs) and the most straight foward thing I could think of is of course the massive Globstruct include file...
without using static libs, is there really any other "good" method of sharing info between the core and DLLs?

btw I've already implemented this, along with a Messaging system, but I was really just curious...

Open86 --My Emulator (now with it's first super alpha release
I'm addicted to placebo's...I would quit but it wouldn't mean anything! lol
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Mar 2007 22:18
The problems with passing a pointer to a great big structure containing everything are:
- Changing something in it means that *everything* needs to be recompiled.
- DLL's that access it can change the values, either accidentally or deliberately

Instead, I'd suggest that you:
- use different structures for different purposes.
- pass a copy of the information, not the 'real' copy from the kernel.
- pass only what has been requested.

For instance, instead of passing a structure to the main entry point, pass a function pointer or two that the DLL can use to query/command the kernel. See the windows calls GetSystemMetrics/SetSystemMetrics for an example of how this would work.

Login to post a reply

Server time is: 2024-06-16 08:44:20
Your offset time is: 2024-06-16 08:44:20