Archive for the ‘4D’ Category

4D v11 Plug-in Development Tips

Saturday, May 29th, 2010

Here are few tips regarding the 4D v11 Plug-in development (particularly using the XCode):

  1. By default the Architecture mode for the Project Development Configuration is “Native Architecture of Build Machine”. This means if you are developing this plug-in on the Mac Intel machine, your plug-in will not work on the 4D if it’s running in the Rosseta mode. If you change to Deployment Configuration, you will notice that the architecture mode default is “ppc i386? (required for Universal plug-in). Of course, for the development it’s ideal to keep those settings (as it builds fast), but just want to share so that you don’t spend some time on this issue like me if this is your first v11 plug-in.
  2. If you want to change the bundle name (of course, you can do this manually after every build, but it’s a hassle), then you can do this from the Target Properties window. Simply right-click on the Target, and click the “Get Info” menu item. In the Properties window, to set the default bundle name, set the required name in the “Product Name” field (under the Packaging group).
  3. If you are migrating a plug-in, then most of the header file related to the GUI are now part of the Carbon Framework, and this Framework is already included in the default Project created by 4D Wizard. You can simply comment the those header include commands in your header file, and it should work. If you see a function is still undefined, then most probably it’s moved to some other framework, you can search on the web for this, or you can simply use the OS-X Finder search (it works very well). You can add the new Framework by right-clicking on the Project name and selecting Add -> Existing Frameworks.
  4. If 4D crash during your plug-in testing, and you think it was due to your plug-in code, then you can confirm this by looking at crash report generated by Mac OS-X. For this, when you see the OS-X Application crash report window, click on the Report and see the active threads calls. See if any of the thread was running your plug-in code. This might help quickly locate the function/code which is causing the problem.
  5. If you get the error “The plug-in method cannot be executed” on the deployed server on Windows, then most probably the target machine doesn’t have the required C/C++ runtime libraries. One simple way to check and fix this is to statically link all the run time libraries with your plug-in DLL by setting the “Runtime Library” value to “Multi-Threaded /MT” in the “Code Generation” section of your Project properties.
  6. Last, but not least, I was looking for a interactive debugger option in the XCode (similar to the one we get by using the “Attach to Process” in Visual Studio). After spending some time, I figured that out too. The process is simple, but a bit different and that’s what took me some time. The key point is that before you can debug the plug-in, you need to launch the 4D from the XCode. To do this, add the 4D application as the Executable from the Project Menu (using option “New Custom Executable”. Once you have done this, “Build and Go” should be enabled, click it and it will auto launch the 4D Standalone application. From there you can open the testing structure and now XCode will stop at the breakpoint as soon as 4D execute the corresponding code.

That’s all for today. I will keep adding more, as I experience them

4D v11 Plug-in Development

Saturday, May 29th, 2010

or the last couple of days, I have been working on the migration of one of the 4D Plug-in to the v11, and it has been a fun and frustrating experience (to some extent). It was frustrating, because there is very little help available, and there is no starting guide. You have to explore and go on your own.

To make things life easy for some others (and for my future references), here are some interesting links/resources:

4D Plug-in SDK: http://www.4d.com/us/downloads/products.html

I have found the Plug-in Wizard to be very helpful and idea for Jump Start. Even if you are migrating a plug-in from the older version to the v11 SDK, then you might find the skeleton created by this Plug-in SDK wizard very handy. You can review the skeleton code to see how the new Uni-string parameters are passed, and how to use them.

4D Plug-in SDK Overview: ftp://ftp-developpez.com/4d/documentation/manuels/us/4D-v11-SQL/4D_v11_Plugin_SDK.pdf
Though there is not much detail in this document, but still might contain some new info if you this is your first v11 Plug-in Project.

4D Plugin API, Command Theme List: http://www.4d.com/docs/XKC/XKCMDUS.HTM
This online resource provides a basic info about the each command available in the 4D Plug-in API. Again, though the details are not very thorough, and any clever programmer can easily extract this much info by just looking at the method signature, but this might come handy for a quick reference (specially when you are not in a mode to review and understand each API command call)

4D Plug-in Mailing List Archive: http://old.nabble.com/4D-Plug-Ins-f15655.html
Last but not least is the online mailing archive about the plug-in development. To be honest, this is the largest knowledge base I can find about 4D Plug-in development. If you are stuck into problem, check this first. There are very good chances, that the problem is already been discussed and answered. If it’s not, you can post another thread :-)

That’s all for now. I will try to put some more tips and learnings in the next couple of days.