Skip to Content

Writing a UDO implementation DLL is not an easy task.

To start with, you need to write it in C++ and compile it into a DLL.

If you installed the SBO SDK,

There is an example of this UDO DLL implementation.

Event so,  it is not as easy as one would think of.

Especially when not experienced in building a C++ DLL having reference to another DLL.

There is no clear documentation available also, the only hint is some answer by Yatsea Li in UDO – DLL (1)

I will just give some guidance on how to get the sample up and running, so you can play around with it .

1. Start up your Visual Studio, and load the project.

DLLImplementation1.jpg

2. Note that the default platform is in Debug-Win32.

Now, if you build it, you should get your DLL. And you would expect that providing the DLL into the UDO registration wizard should do the trick.

Well, it will depend on your installed Visual Studio.

If you have a Visual Studio 2005 with SP1 installed, you should be good to go.

If you are like me, having uninstalled my VS2005 for the VS2012, the DLL will throw you an error during installation.

DLLImplementation2.jpg

Now, the sample project references the ‘B1UdoApid.lib’ which you can find under the C:\Program Files (x86)\SAP\SAP Business One SDK\Samples\UDO\MealOrder\DllImplement folder.

In turn, this lib references the VC80 ver 8.0.50727.762 which is a VC++ 2005SP1 redist.

3. You would thought that installing the redist would solve the problem.

Lo and behold you still get the error message.

Check your windows event logger. :

Activation context generation failed for “C:\Program Files (x86)\SAP\SAP Business One\AddOns\MyImplementation.dll”. Dependent Assembly Microsoft.VC80.DebugCRT,processorArchitecture=”x86″,publicKeyToken=”1fc8b3b9a1e18e3b”,type=”win32″,version=”8.0.50727.762″ could not be found. Please use sxstrace.exe for detailed diagnosis.

Note that it is asking for a DebugCRT! Well the only way to get the DebugCRT redistributable is to install the VC++ 2005 .

Ok, You could download a VC++ express edition 2005 from Windows Development.

Downloading and installing this version would solve your problem. Now you can try the implementation DLL and see how to modify the DLL to suit your need.

But wait, what if you need to deploy it to the client ?

Does it mean that you need to install VC++2005 express edition on every single client’s PC ?

Obviously, we should only install the redist to the PCs. But the redist is only available for the release mode.

4. The answer here is you need to change your platform to release x86.

After changing to release mode, there are still a few minor steps to do. If you try to build your project now it will result in error :

error LNK1181: cannot open input file ‘B1UdoApi.lib’

Note the difference, in point 2, when we are building in debug mode, the project references the B1UdoApid.lib, which should be under your project folder.

When we change to release mode, it is looking for the ‘B1UdoApi.lib’.

Browse to your C:\Program Files (x86)\SAP\SAP Business One SDK\Samples\UDO\Include\VS2005

Copy and paste the file to your project folder.

5. One last step,

Open your project properties, make sure your configuration is in ‘Release’, Go to Configuration Properties – Linkers – Input.

On the right hand side, under the module Definition File, key in  ‘MyUDO.def’ (this should be the file name with the extension ‘.def’)  under your project folder.

DLLImplementation3.jpg

Failing this step will  give you another error in during the UDO registration.

DLL does not contain the “Create Object” function [User-Defined Object – Extension Name]

6. Compile your project and you should get your dll file.

Register this DLL file to the UDO registration and it should successfully registered.

When installing on the client side, don’t forget to make sure the VC++ 2005 SP1 redistributable is installed.

Hope this will help somebody out there…

Happy Coding.

Edy

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply