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.

Dark GDK / This NEVER happens in FreePascal (FPC) - This is a C++ Ouch

Author
Message
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 20th Sep 2007 04:41


I just had to share with my fellow gurus something really cool about FreePascal. The way it works - this never happens. The "name spaces" are completely Separate. you never have to worry about using the name of an existing routine in another lib unless its an entry point. Like dbPlayMusic would not be a good idea - but UpdateMusic - a "private" thing in DarkGDK would be "unknown" and mine would compile fine.

Just had to bring it up... Its one of those very powerful tools not many people realize is as fast and faster than C++ and runs on other OS's too. I originally bought DarkGDK to write code with it but the way the DarkGDK main thing worked - I never saw an effective way to do it. I'll use it for addon dll's for this in the future though. It's most sweet.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Sep 2007 14:22
In these instances, you can either rename your function, or put your function into a namespace, and either call it with the namespace included, or to use a using directive to import your function into the global namespace.



To be honest, the fault here is with the library. Internal functions should either be made static, or put into an anonymous namespace if not available outside the module, or into a named namespace if to be made available.

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 20th Sep 2007 14:35 Edited at: 20th Sep 2007 14:57
Quote: "In these instances, you can either rename your function..."
- Yuppers. This is what I did - no biggie.


Quote: "...or put your function into a namespace, ..."
Didn't know that... makes sense the way functions and function pointers work...

Quote: "...and either call it with the namespace included, ..."
I knew this would work like the variables after reading above ....

Quote: "...or to use a using directive to import your function into the global namespace."
What directive is that? Just the using clause right? I do like the using clause!


Quote: "
To be honest, the fault here is with the library."


Yeah its not perfect - but what is - I'm still a Fan!

Quote: "Internal functions should either be made static, or put into an anonymous namespace if not available outside the module, or into a named namespace if to be made available."


That is cool that this can be done. One of the things I like about FPC is is simply in the "Interface" section or its not. "Interface" section is just like a header file - where you declare variables and functions/procedures so that externally linked/compiled stuff knows how to use. Everything not "declared there" is private and you don't actually need header files. This also makes FPC compile twice as fast.

It also has smart linking which IanM - you would likely appreciate. Basically - it only brings in code to the EXE/DLL that your code actually calls or code linked one way or another to stuff you made available (like for DLL use). I've compiled against a "source library" with thousands and thousands of lines of code - and seen it make really tiny exe's because I only used one or two calls.

Thanx for the C++ knowledge you tossed in that message. It's all in the details

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Sep 2007 19:01
Importing the function into the global namespace (actually the current namespace) can be done with a 'using' directive. In the example above, the first 'using' imports that single function, while the second one imports everything from the named namespace.

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 21st Sep 2007 19:56
Got it - Thanx as usual. Anyone volunteer a requirements list for your oop wrapper document or a doc'n a fresh install? If not - will I be able to uninstall my DirectX entirely to make it seem "Clean" if I was to give it a go?

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Sep 2007 22:05
No, no volunteers yet.

I'm after a little more than a DirectX install, which may be why no-one has volunteered - it's the full install of VC++ Express, the Platform SDK and DirectX I'm after, which means all three need to be uninstalled and then reinstalled, which will take a lot more time and could break what you have.

I've found some info about the installation on a single page from a site I trust, and at some point I was going to use one of my older machines to test the process on.

Install of VC++Express + Platform SDK : http://www.codeproject.com/useritems/FreeVS2005Win32.asp

Don't worry if it's too much, as I'll get around to it sometime, but if you do, it would be a great help.

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code

Login to post a reply

Server time is: 2024-11-19 16:30:29
Your offset time is: 2024-11-19 16:30:29