Game Programming and Development Tools

a questin for the linux gurus – klumsy

Klumsy

Administrator

Posts: 1061
From: Port Angeles, WA, USA
Registered: 10-25-2001
i am starting to play around with linux, after not touching it all since the mid 90's.. i have some tehcnical question, wondering if anybody may know the answers

one of the most powerful things in windows (and also one of the things that makes it so slow) is COM (activex, ole etc). i am wondering if linux has such a model yet.. the nice thing about some microsoft products (as if anything is nice) is how i can automate different functionality of them through com, i can make a program that drives any office application, in so many ways possible.. i can automate internet explorer and use so many interfaces to mess with its internals, add functionality in my own app etc

is there something like COm at all in linux (and don't say corba) and if so, is it used by many

another question: i know linux has its equivilent of DLLS, but does it have object orientated dlls (as many activeX ones are), but also microsoft visual C++ has its own special dll format to make DLL's object oriented rather than just a list of functions.

Karl

------------------
Karl /GODCENTRIC
Visionary Media
the creative submitted to the divine.
Husband of my amazing wife Aleshia
Klumsy@xtra.co.nz

CobraA1

Member

Posts: 926
From: MN
Registered: 02-19-2001
Hmm, I don't know the answer to all those questions. COM sounds dangerous - with that level of integration, what kind of damage could a virus do (ActiveX comes to mind . . .)? What do you automate with it anyway?

I think there is some form of it - I see a lot of programs that use the gecko renderer for displaying HTML, so I think it might be possible. How it's done exactly, I don't know.

But I personally dislike the "app within another app" idea of doing stuff. Creates more problems than it solves, IMHO.

------------------
There are two kinds of people: those who say to God, "Thy will be done," and those to whom God says, "All right, then, have it your way." -- C. S. Lewis

Switch Mayhem now available! Get it here
Codename: Roler - Writing object code and GUI.

Klumsy

Administrator

Posts: 1061
From: Port Angeles, WA, USA
Registered: 10-25-2001
well first i'll answer your questions, but my main need with linux is not such a deep automation interaction with other applications as i specified with com, but basically shared objects, DLLs that are object orientated.

There is a danger of such intergration, but its not as huge as you think, but i'll cover that a little later

What sort of things do i use COM and ole automation for?
one typical example is putting a webbrowser into your own applicatin (internet explorer), some people just do the basics, but if you are to have buttons for stopping, refreshing, go to web pages etc, you need an interface to be able to activate those things.. in one of my projects , we have a bank that we download about 1 gig of zips containing images of checks daily. the only way to do this is through their webpage by logging in, navigating to the correct pages and downloading smaller zip files.. we don't want to pay a person all day to sit there and boringly do this over and over.. normally in such a project you could just make a spider sort of app that just usses HTTP (with SLL) plainly but their website doesn't work that way, as links to where the files are etc are generated by javascript, do you'd hjave to implement a javascript interpretter as well, and there are other quirks that make it IE only.. so with automation we have a browser object, which we programmitically using COm interfaces get it to browse to the main page, (then wait for an event taht the document is loaded), enter in the login and password in the correct places in the webpage (using the hyrachy of Ihtml* object, and programatically tell it to click the page etc etc etc, until we have then parsed an accoutns page, then clicked the right link tol go to the details page, then get he link to the zip file, (then we download the zip file programatically, unzip it programatically, update database information by its contents, and burn it to a DVD programatically)

another example of using the internal interfaces of IE is something i am working on now.. we use reporting services for reporting, which generates itneractive webpages, we have our own front end that generates the requests, sets everything up etc, that is all fine.. however reports can have drill through links to other reports (i.e you have a customer report, that lists the customers orders, and then if you click on the order it will go and run a specific order report for that order).. reporting services makes this link automatically , and if you click on it, it will automatically run it.. i don't want this behaviour, i want it to be if they click on a report, our system with intercept that click, then we'll add a report request in our reporting engine, to the reporting queue, and the the server will go and run the report, and it will come into their reporting inbox.. so using com again, i can override the event for when a link is clicked, and if its a link of importance to me, run my own code as above..

another example of using the webbrowser is internet explorer comes with a MSHTML editing control, and many applications that have WYSIWYG use that control in their applications.


another example is flash, you can imbed flash into your own applicatins, and flash has a method of being able to have actions script (which only affects things inside flash be linked with backend code you can make .. so you can make an exe , imbedded with a flash GUI, and that flash action script can do things like save files, etc etc..

also maybe you want to imbed a pdf viewer into your application..

maybe all your customers will have excel installed, so you can imbed an excel sheet into your application, using COm to set various restrictions, and various calculations etc..

one example i've used excel for, is a certian product outputs only excel XP sheets, and our users used excel 2k, so i used a copy of excel 3k on a server and using COM, i wrote a program that opens all these3 excel XP files, then exports them to excel 2k.

another example with excel is first autoting some SQLSERVER functionality to do a DTS (data transform), then creating an excel file, populating the fields accordingly and saving it. the list goes on and on and on

but this isn't the main use of com, these are using external applications, you can see these applications not only as applications but also as libraries.

another area of com/activex is visual controls.. lets say i made a commerical control for resale that is a image viewer and it can load a JPG and BMP formats. being an object is absolutely necciary (a standard DLL would be very very tedious to use), because you can basically just create a new instance of this Imageviewerclass.. set its visual container, run methods to load, save, maybe edit, apply some filters zoom etc..

and because its a proper object (whether a COM one, a delphi component, a C# assembly, or a java class) somebody can decent from it and make a version that can load PNG's and maybe have some more filters, maybe color reduction or whatever. trying doing that with a standard DLL..

you can have ZIP libraires that are plain dll's but having one that is an object is much better alot of the time.. my interest really isn't the automation side of things, but whether linux SO's natively support objects or are just plain old windows DLLS

(plain old windows DLLs) don't support objects, they are just a list of functions, and only specify the function name actually, a raw entry point into code.. the dll can't tell you what calling convention that function has, it can't tell you whether it has a return value, or any of the parameters, the person who writes code that communicates with the DLL just has to know that, many dlls don't even have a function name, but rather just a NUMBER, so the table is just a list of number indexes and their relative entry point, the calling code has to have a header file that links up that DLL export number with the correct name, correct parameters, and correct calling convention.

i'm wondering if linux SO's are the same
com/activex are DLLs, but following a COM standard that allows them to be COM objects and can contain a type library which describes the objects, their properties , methods and events, so the code (through the type library that sometimes is in the DLL,exe and sometimes a seperate file) describes itself, and any languatge that can use com objects can thus use that library. i think java classes are similar, and in C# and dotnet, every single dotnet EXE and DLL (assembly) is self describing, it describes all the classes and structures inside it, giving the names, what interfaces they use, what they are inherited from, all the public methods,properties and events, so any dotnet language can use that library.
in C# i can inherit from a class written in vb.net without having to have the sources
I was hoping that maybe linux had something similar (i know java is like that, with classes that you can just use, inherit from without having to have the source code etc .
but plain windows DLLs do not have this function. it means in C++ you can't write a library that has objects the caller can use.. (well microsoft visual studio.net uses its own method to do this, and its not standard and thus not compatible with other C++ compilers)

i'm wondering if maybe GNU C++ has such a method (and i suppose it wouldn't have to be compatible since its the standard C compiler)

also delphi has special DLLS (packages) that can contain classes and components.

i wonder what languages in linux can contains Shared Objects that are acutally object orientated, and i'm curious about compatibility between languages in linux. i was just hoping that they would have build a standard object orintenated shared object into the kernal by now (and hopefully a better one than COM). it would so increase the value of linux, because such code reuse is sooo useful and flexible and probably one of the most powerful things about windows (though when used wrong it makes windows sooo slow)

as for the security stuff of COM etc.. well people getting viruses etc from activeX controls in web pages is not so much because of COM technologies but because by running that activex control is just letting internet explorer be the UI host for a program, so its the same as downloading a program from the net and running it on your computer, because that activex control has its own code, and it can run and do whatever it wants.. activex controls inside webpages weren't designed for that scenario..
the cool thing about dotnet, is this, its code is so self describing etc, and it runs in a virtual machuine like java, and because of this it enables certian security, you can make any code you write (or code already in the framework) to have certian security priveldges like network access, or filessystem access etc.. and the running code or enviroment can specify limits (i.e code running cann't access the file system etc etc)
so it means in the future you could download a C# assembly into your webbrowser (like you would an activex library), but can specify that that particular code only has permissions to touch itself, i.e it can't touch any other objects in the system, nor filesystem etc etc. (same with installed applications.. and basically what happens is when its running that code and if that code contains code that touches the filesystem it just won't let it, and it will through an exception.


anyway i am not a microsoft salesperson. like many developers my relationship with microsoft is love-hate.. my attitude with MS is generally,

good concepts, bad implementation - bad neighbour

------------------
Karl /GODCENTRIC
Visionary Media
the creative submitted to the divine.
Husband of my amazing wife Aleshia
Klumsy@xtra.co.nz

MadProf
Member

Posts: 181
From: Larnaka, Cyprus
Registered: 01-24-2001
Hi klumsy,

I have not done much GUI programming in linux, but I believe it is possible. In gnome, there is (lib)bonobo, which is a system for sharing functionality, embedding abiword or gnumeric or whatever. I think KDE has something similar. Actually, KDE probably has something better, but I irrationally dislike KDE (dunno why) and so can't tell for sure. I know one can embed mozilla into apps fairly easily, many do so. I don't know if it is as easy as embedding IE in VB (I doubt it. I once wrote a veeery simple browser in VB, back in my windows days, embedding IE was almost just drag and drop).

Um, anyway. Bonobo might be what you are looking for. And KDE almost definately has something. About C++/OO SO files, I expect so. I have not ever done C++ though, so I'm not sure. KDE uses C++ for everything though, and they embed all kinds of weird things (take a look at some of the konquerer screenshots sometime), so I would guess so.

Here is an article about something... looks rather horrible to me, but what do I know
http://www.linuxjournal.com/article.php?sid=3687

Here is a KDE article, which tells about how they do it (I think) it doesn't look so bad here.
http://developer.kde.org/documentation/tutorials/kparts/

If you are into C++ and embedding and all that, you will probably find KDE more your thing. Anyway, before I spout any more rubbish, and say any more stupid things, I'm off to bed.

Hope I haven't offended you or said anything too truely inane,

Dan

------------------
7 days without prayer makes one weak.

Klumsy

Administrator

Posts: 1061
From: Port Angeles, WA, USA
Registered: 10-25-2001
you haven't offended me, thank you for the time and effor you put into researching this info for me, it is quite insightful and helpful.. from the first article it shows me that linux doesn't have that functionality built into it , but you rather have to make creative hacks to 'simulate' it yourself.. rather sad..
the kde looks interesting and promising though ther is a possibility its components are only visual.. it would be good to use nonvisual ones also

thanks again
much appreciated
Karl

------------------
Karl /GODCENTRIC
Visionary Media
the creative submitted to the divine.
Husband of my amazing wife Aleshia
Klumsy@xtra.co.nz

CobraA1

Member

Posts: 926
From: MN
Registered: 02-19-2001
First off, it's possible to some extent - I've seen the Gecko engine from Mozilla in many projects. In fact, that's probably what you'll want for most of the webpage stuff.

Not sure what CORBA is, or why you dislike it - but you might want to take another look at it?

"i can automate internet explorer and use so many interfaces to mess with its internals"

hint: Open source = you can mess with the code directly, not just through interfaces . . .

In fact, AFAIK, most people who do the kind of stuff you describe will actually take advantage of Open Source and directly edit one or both programs to fit their needs.

You might want to do what other peeople have - use the Gecko engine. And consider complaining to the bank about IE-only pages . . .

As far as your reporting problem - well, I personally use PHP to generate webpages, perhaps you can find an open-source or more pluggable-friendly version of your reporting program? Or, if it's a relatively simple program, just make your own?

"another example is flash, you can imbed flash into your own applicatins"

The last thing I need is flash in an app . . . (and in any case, I program w/Java, which has its own built-in HTML engine and 2D drawing stuff )

"also maybe you want to imbed a pdf viewer into your application.." GhostScript . The viewer is seperate, so you just make your program a viewer (maybe even take some source code from the viewer itself )

"maybe all your customers will have excel installed" You'll have to use Windows, because there's no Excel on Linux , unless you want to use Wine - in fact, I'd be willing to bet that Wine supports COM, so you might not have to actually give up using COM.

I can't say much about whether Linux DLLs are object-oriented, because I've never programmed DLLs, it might be worth a look at the GCC docs.

If object-oriented dlls are part of the C/C++ specs, then yes - I do know that GCC follows the specs very closely. If not, then maybe, maybe not.

"i think java classes are similar"

Yup . If you program Java, then Beans and reflection are what you're looking for. All of this stuff is possible in Java - although it's mostly between Java programs. For doing this kind of stuff with non-Java programs, you can use CORBA or JNI. But as long you're just working in Java, you can dynamically load classes using reflection.

------------------
There are two kinds of people: those who say to God, "Thy will be done," and those to whom God says, "All right, then, have it your way." -- C. S. Lewis

Switch Mayhem now available! Get it here
Codename: Roler - Writing object code and GUI.