On 16/02/2016 at 07:42, xxxxxxxx wrote:
Cinema 4D Version: R17
Platform: Windows ; Mac ;
Language(s) : C++ ; PYTHON ;
Sorry in advance for this "vague" post.
I am really struggling between c++ plugins on a mac and on a pc.
I develop my plugins on a pc (windows 8.1 and vs c++ 2013 express) and then port them to mac (OS X 10.9.5 and Xcode v5.0.2).
On the pc it is working ok, but I am getting weird access violations on my mac.
I suspect my string handling functions.
I can "remove" the error by stripping until I see what is the cause(?).
But I cannot explain it.
E.g. if I stop using a boolean userContent, then it seems ok.
So, I guess I mis-use a pointer somewhere.
- does xcode initializes the variables different then vs 2015?
- how important is the string format (unicode, ansi, utf8, etc.)
If so, what to use?
My string functions mostly handles url's with very strange char sequences.
- are there common issues know when porting from pc to mac?
- I also see that the xcode compiler / linker is more rigid the vs.
What compiler / linker options are important for xcode and for vs?
- are there tools to check the code for non initialized variables, pointers, etc.?
For example, I do not init pos1s.
Would that make a difference between pc and mac?
Int32 pos1s; // should this be Int32 pos1s = 0. Or should it be a Int64 (pointer)
cs = "usercontent";
ret2 = url.FindFirst(cs, &pos1s, 0);
I know it is a vague post, but hopefully someone can shed some light on it.
On 17/02/2016 at 01:38, xxxxxxxx wrote:
I'm not a great compiler expert myself so I cannot add much from personal experience. The correct Xcode version to develope R17 plugins is Xcode 6.
Xcode uses Clang/LLVM as its compiler, Visual Studio has its own compiler. In the documentation you can see how to setup a Visual Studio Project from scratch to see what options have to be set.
On 17/02/2016 at 03:19, xxxxxxxx wrote:
In your case the value of pos1s is undefined. It is not automatically zero initialised (btw this also is the case as class members if not value-initialised).
It is indeed good practice to initialise your PODs/objects, so Int32 pos1s = 0; even if it seems redundant.
If that undefined state makes any difference or trouble depends on how FindFirst() is using it. If it assigns a new value ONLY if it finds the string and otherwise leaves it untouched, then pos1s remains undefined (it could be any value!) and this could of course be a potential problem in following code processing.
On 17/02/2016 at 07:34, xxxxxxxx wrote:
Thanks, I will install Xcode 6 and initialize ALL variables.
I can compile and run the plugin successfully on my Mac, but the user now complains that the plugin is not being started. It is not there when cinema 4d is started.
The plugin should give out a message when successfully started.
How can I detect whether the plugin is crashed or something else is happening?
We both run on R17.048 (I am not sure about the whether we use the same Mac OS version).
Can I start cinema on a Mac in debug mode without using Xcode (how to add add g_alloc=debug to the command line).
On 17/02/2016 at 08:49, xxxxxxxx wrote:
I can start it using
/Applications/MAXON/CINEMA\ 4D\ R17.048/CINEMA\ 4D.app/Contents/MacOS/CINEMA\ 4D -debug
but that does not give a lot of extra information.
E.g. I do not see which plugins are started?
What else can I do to remote invest whether the plugin is loaded / crashed?
On 17/02/2016 at 09:41, xxxxxxxx wrote:
You could just write something to disk or open a question dialog or so in your PluginStart() I guess.
There are too many variables involved for me to guess what exactly is the reason I'm afraid. Could be a compiler setting, could be user error (e.g. wrong installation), could be a String defined in global scope...
On 17/02/2016 at 12:14, xxxxxxxx wrote:
Yes, I understand it is not that simple, indeed too many variables.
I guess, taking it step by step is the best way.
I will start by adding something into PluginStart() and hope that gets executed before something "happens" to the plugin.
Also, I created a very simple plugin for the user to test and even that one does not show up in cinema (wrong installation - what are the mac os requirements for R17.048?).
Anyway, thanks for the support and I hope I can ask more (stupid) questions.
On 18/02/2016 at 01:22, xxxxxxxx wrote:
just some more hints: if a plugin was installed in the "plugins" subfolder of the Cineam 4D installation it might be needed that the user deletes the "directorycache" folder in the preferences folder. An alternative is to install the plugin in the user folder.
Also on OSX one should check if the disk permissions of the volume storing the Cinema 4D installation are in order.
On 18/02/2016 at 03:05, xxxxxxxx wrote:
Yes, it had certainly something to do with my process flow.
- create lib + folder on pc
- create lib + folder on mac
- copy mac lib to pc plugin folder
- zip plugin folder
- copy zip to mac
Doing this the plugin did not show up.
Without copying the mac lib to and from the pc, the problem is now solved.
The plugin shows up in cinema!
Thanks for all the support.