DLLs for Linx and Mac?

Started by
31 comments, last by Cromulent 15 years, 10 months ago
There is nothing magic about cross platform stuff. The code isn't built once and it works for every platform. It has to be built on the target plaform to be compiled into whatever format that platform uses. Except for Java but I don't think he is talking about that. So if you wanted to create a Maya plugin you would have to write specific code for each platform and have preprocessor settings to compile the correct code for the platform you are trying to target.
--------Ratings - Serious internet buisness
Advertisement
Basically you use a scripting language MEL(Maya Embedded Language ) or python. If you need to write a C plugin then you have to recompile to support multiple platforms.
Quote:Original post by Oluseyi
Quote:Original post by EmptyVoid
Ok how do I make a SDK?

Wow. That's a huge question.

An SDK - a software development kit - is a collection of tools, utilities, dynamic libraries, static import libraries and source code to assist and/or enable developers to create solutions that target a specific platform. That platform can be an operating system (eg, Windows SDK), a set of interfaces that abstract access to resources like hardware (eg, DirectX SDK), or even a single application (eg, Maya SDK). An SDK is authored the same way you author any collection of code and applications - that is not your problem. Your problem is that you don't fundamentally know what you are doing.

Let's start at the beginning. What do you want to accomplish? From your posts, it appears you want to create an extension mechanism for an application (eg, your game) that works across platforms - Windows, OS X, Linux. The first thing you need to realize is that these are three separate products - three separate applications compiled specifically to those operating system platforms, and a similar/identical extension mechanism across all three.

The following assumes you're writing your game in either C or C++.

Let's say you've written a game for Windows, using an abstraction toolkit like SDL so that your game builds under Linux simply by recompiling. You now want to add to your game the ability to load new functionality from a dynamic library or shared object present in a specific folder. For Windows, you need to call LoadLibrary to open the dynamic library, then GetProcAddress to obtain the address of a particular function implemented in it; for Linux and OS X (after 10.3), you need to call dlopen to load the shared object, then dlsym to obtain the address of a symbol defined in the library. C and C++ support the notion of conditional compilation via the preprocessor: you can check for the existence of platform-specific symbols and cause different branches of code to be compiled as a consequence.

#ifdef _WIN_VER    // Windows    LoadLibrary(...);    ...    GetProcAddress(...);    ...#elseif __APPLE__  // Mac OS    dlopen(...);    ...    dlsym(...);    ...#elseif __linux__  // take a wild guess    dlopen(...);    ...    dlsym(...);    ...    // despite calling the same function, the parameters for Linux may differ    // from Mac OS X, so we separate those platforms as well#else    // you can disable the application from loading plugins, or whatever#endif


But what if you don't want to mess about with platform-specific dynamic library techniques? Well, then you actually have to do more upfront work to simplify things on the end. Say you want to create something comparable to the Maya Embedded Language; then you need to create the plugin language (or pick one - there are dozens of extension and embeddable languages), build/select the compiler, integrate it into the toolchain used by your developers (including your end users if you allow them to develop plugin and extensions), and then embed an interpreter or other mechanism to parse the compiled object files within your application.


As you can see, there is a lot you need to do. Get busy, and good luck!



Yeah I can see that this will add three times as much work so I should just make it for windows...
This is your life, and it's ending one minute at a time. - Fight club
Quote:Original post by stonemetal
Basically you use a scripting language MEL(Maya Embedded Language ) or python. If you need to write a C plugin then you have to recompile to support multiple platforms.

Yeah I just noticed by looking at all the new versions of the 3D software that they all seem to support some sort of Python scripting now like Blender-LOL!
It's cool to see that Python is finally starting to take over from all these proprietary scripting languages each 3D package used to use.
[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe
Quote:Original post by daviangel
Quote:Original post by stonemetal
Basically you use a scripting language MEL(Maya Embedded Language ) or python. If you need to write a C plugin then you have to recompile to support multiple platforms.

Yeah I just noticed by looking at all the new versions of the 3D software that they all seem to support some sort of Python scripting now like Blender-LOL!
It's cool to see that Python is finally starting to take over from all these proprietary scripting languages each 3D package used to use.


Python really does seem to be the up and coming scripting language. I really, really must sit down at some point and give it a whirl but I keep getting put off by the whole tab based syntax.
Quote:Original post by Cromulent
Quote:Original post by daviangel
Quote:Original post by stonemetal
Basically you use a scripting language MEL(Maya Embedded Language ) or python. If you need to write a C plugin then you have to recompile to support multiple platforms.

Yeah I just noticed by looking at all the new versions of the 3D software that they all seem to support some sort of Python scripting now like Blender-LOL!
It's cool to see that Python is finally starting to take over from all these proprietary scripting languages each 3D package used to use.


Python really does seem to be the up and coming scripting language. I really, really must sit down at some point and give it a whirl but I keep getting put off by the whole tab based syntax.

It's really not as bad as old Fortran where you had to line everything up in certain columns or your code wouldn't compile-LOL!
I kept putting off Python too thinking it was going to be that bad but you get used to it fast and if you use a decent IDE you probably won't even notice it. I know IDLE doesn't seem to though since that's what I used when first learning Python and some simple code wouldn't compile and I couldn't figure it out for the life of me what was wrong and it was just that I didn't indent some code but of course I didn't get any error message to that effect!

[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe
Quote:Original post by EmptyVoid
Yeah I can see that this will add three times as much work so I should just make it for windows...

No it doesn't. You only have to write the dynamic library loading and management code for each platform (which is around a couple of hundred lines of code). Everything else stays exactly the same.
Quote:Original post by Cromulent
Python really does seem to be the up and coming scripting language. I really, really must sit down at some point and give it a whirl but I keep getting put off by the whole tab based syntax.

It's not tab-based. It's whitespace as usual, and it's actually quite flexible: you can use a single space to indicate a new scope indent. You can even mix whitespace within a file, but not within a single scope block (obviously, as changes in leading whitespace indicate a change in scope), though it's not really a good idea to. A Python-aware text editor will also highlight indentation errors.

Besides, you'd be indenting your code anyway in any other language. Python just makes that meaningful. Don't let that stand in the way of your learning it. I did for a while (back in 2002), but once I got over it and actually tried it, I discovered a very, very nice language. I now turn to it first.
Quote:Original post by EmptyVoid
One thing though why on earth would you want a Mac or Linux in that case?...


Are you seriously saying that 3ds max is that good? In my opinion it's by far the worst 3d package out there. Maya, Xsi and even blender are far better - and all of those run on Mac and Linux (as well as windows).
Quote:Original post by EmptyVoid
I've worked with all of them there not as good for video games.


I've worked with all of them for the last ten years or so. I can assure you max is not as good when you start dealing with custom plug-ins for level editing, custom particle system engines, and custom shaders....

I suspect that you haven't actually used XSI, because if you had, you wouldn't be singing Max's praises quite so highly. I'm more of a Maya person myself, but that's because it's by far the easiest one to write plug-ins for....

This topic is closed to new replies.

Advertisement