OOP lib
-
- Enthusiast
- Posts: 142
- Joined: Mon Sep 17, 2007 10:28 am
- Location: P.O.P
- Contact:
OOP lib
How can I use classes from OOP libs in PB?
-
- Enthusiast
- Posts: 142
- Joined: Mon Sep 17, 2007 10:28 am
- Location: P.O.P
- Contact:
- Rook Zimbabwe
- Addict
- Posts: 4326
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
OOP has the advantage of being able to make tiny little problems into complex and frustrating HUGE problems...
That said... the OOPfiles speak here:
http://www.purebasic.fr/english/viewtop ... t=oop+pure
here:
http://www.purebasic.fr/english/viewtop ... t=oop+pure
and here:
http://www.purebasic.fr/english/viewtop ... t=oop+pure
I frankly cannot see why you would wish to torture yourself that way. My framework is slightly OOP like, but instead modified for inline ASM stack. Well, I think it is!
That said... the OOPfiles speak here:
http://www.purebasic.fr/english/viewtop ... t=oop+pure
here:
http://www.purebasic.fr/english/viewtop ... t=oop+pure
and here:
http://www.purebasic.fr/english/viewtop ... t=oop+pure
I frankly cannot see why you would wish to torture yourself that way. My framework is slightly OOP like, but instead modified for inline ASM stack. Well, I think it is!
-
- Enthusiast
- Posts: 142
- Joined: Mon Sep 17, 2007 10:28 am
- Location: P.O.P
- Contact:
It depends how the methods are wrapped up inside the lib. If it is a COM dll, well that requires use of interfaces and GUID's etc. There's enough examples in these forums of doing that kind of thing.
If you're talking about a static library built from an oop language (like Emergence Basic for example) then you may be able to get away with importing the functions by hand and building an interface yourself - it depends how the methods are built to accept parameters and whether they are to accept a *this type parameter etc. If this is not the case then you may just be able to import the functions for a c-style wrapper etc.
You will need a good definition of the underlying class; it's methods and private data etc. and you will need to know how the method names are mangled when placed into the static lib. oop languages often mangle the names by combining the class and method names etc.
So, there are a lot of 'ifs' and buts' with this I'm afraid.
If you're talking about a static library built from an oop language (like Emergence Basic for example) then you may be able to get away with importing the functions by hand and building an interface yourself - it depends how the methods are built to accept parameters and whether they are to accept a *this type parameter etc. If this is not the case then you may just be able to import the functions for a c-style wrapper etc.
You will need a good definition of the underlying class; it's methods and private data etc. and you will need to know how the method names are mangled when placed into the static lib. oop languages often mangle the names by combining the class and method names etc.
So, there are a lot of 'ifs' and buts' with this I'm afraid.
I may look like a mule, but I'm not a complete ass.
-
- Enthusiast
- Posts: 142
- Joined: Mon Sep 17, 2007 10:28 am
- Location: P.O.P
- Contact:
-
- Enthusiast
- Posts: 142
- Joined: Mon Sep 17, 2007 10:28 am
- Location: P.O.P
- Contact:
- Rook Zimbabwe
- Addict
- Posts: 4326
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
-
- Enthusiast
- Posts: 142
- Joined: Mon Sep 17, 2007 10:28 am
- Location: P.O.P
- Contact:
Well, difficult to comment without knowing more. If you are asking if you can create a dll in PB which contains OOP classes which you can access from a client program - then yes; no problam at all. I am currently working on such a project in which a dll exposes 4 classes and over 120 methods between them.
The dll exports a function which simply initialises a new instance of the class and returns a pointer to the newly created object etc. Very simple, very effective.
All the client program needs in order to make use of the object returned from the dll is a list of all the interfaces exposed by the dll and the methods therein etc. and that's it.
If this is the kind of thing you are asking about then I should be able to knock up a simple example for you. It would have to wait until tomorrow though.
The dll exports a function which simply initialises a new instance of the class and returns a pointer to the newly created object etc. Very simple, very effective.
All the client program needs in order to make use of the object returned from the dll is a list of all the interfaces exposed by the dll and the methods therein etc. and that's it.
If this is the kind of thing you are asking about then I should be able to knock up a simple example for you. It would have to wait until tomorrow though.
I may look like a mule, but I'm not a complete ass.