Advertisement

Passing Pointers btween modules

Started by July 28, 2000 09:00 AM
2 comments, last by D 24 years, 4 months ago
I am in the midst of creating my editor in Windows that has ample support for plugins, and I have run into a spot of trouble, I am stuck because I need to access several objects that are located in the main executable from within an outside run-time linked DLL file. I thought that just passing a pointer to the dll would be enough but niow I know that that does not work. So is there another way in which I can do this so I can call objects located inside the main exe from outside dll''s? could I use loadlibrary or loadmodule or something and then run getprocaddress on it? I don''t think so, but if there are any ideas out there then I''d love to hear them. I had the idea of making another DLL with those objects but that will take a long time to get working... -thanks in advance Dæmin (Dominik Grabiec) sdgrab@eisa.net.au CyberPunk RPG http://www.eisa.net.au/~sdgrab/index.html
Daemin(Dominik Grabiec)
Sounds like you are starving to learn how to use the Component Object Model.

Note that an interface is a pure virtual class like this
    // Declare an interfaceclass IMyInterface{public:     virtual void MyFunc1() = 0;     virtual void MyFunc2() = 0;};// Alternatively you can do thisstruct IMyInterface{     virtual void MyFunc1() = 0;     virtual void MyFunc2() = 0;};// They are both the same    

Both the above declare an object with a virtual function table but all the function pointers will be NULL. An object can inherit from this interface and then other modules of code can make calls to the object via the interface.

Now you are using MFC. So start using COM. COM lets you export your interfaces.
Advertisement
Actually I''m not using MFC, I''m jsut using C++ with the Windows SDK...

Thanks for the advice tho, I''ll try something like that out.

Dæmin
(Dominik Grabiec)
sdgrab@eisa.net.au

CyberPunk RPG
http://www.eisa.net.au/~sdgrab/index.html
Daemin(Dominik Grabiec)
ok I''ve got a question about this too...
I''m starting to learn DLL writing too...

anyways I''m using classes in it and I''ve got a struct to use as an interface...

struct SUnknown{

};

which has no members then I derive CUnknown which has all the stuff I need to have in my base class... I want to do it this way so I don''t have anything in the struct... but will there be a problem where I have no members in the struct when it comes to the virtual function? or will it still work?

Great Milenko

Words Of Wisdom:
"Never Stick A Pretzel In Your Butt It Might Break Off In There."


http://www.crosswinds.net/~milenko
http://www.crosswinds.net/~pirotech

The Great Milenko"Don't stick a pretzel up your ass, it might get stuck in there.""Computer Programming is findding the right wrench to hammer in the correct screw."

This topic is closed to new replies.

Advertisement