libember_slim DLL

477 views
Skip to first unread message

Torben Weibert

unread,
Oct 9, 2014, 5:27:32 AM10/9/14
to ember-plus-...@googlegroups.com
Hello,

first of all, thank you for letting me join this group. I'm CEO of mairlist GmbH based in Dortmund, Germany, and we're making radio automation software for smaller stations.

We have a customer who is going to use our software with JADE Studio, including remote control, so I have to implement an Ember+ comsumer on our side. Unfortunately our software is written in Delphi, so I cannot use the C++ libs out of the box. If I'm not mistaken, libember_slim is the way to go for me because it is pure C, no C++ classes involved, and I can convert the *.h files to appropriate Delphi units and interface with the library.

Which leads to the following question: Is it possible to build libember_slim as a shared library, and if so, does anybody have a precompiled DLL for win32 I could use? Or give instructions on how to build one? I must admit that I'm not an expert when it comes to compiling C libraries...


Thanks for your help,

Torben  

nullable.type

unread,
Dec 2, 2014, 7:55:27 AM12/2/14
to ember-plus-...@googlegroups.com

Hi Torben

Unfortunatley, using libember_slim as Windows DLL is currently not supported. The reason is, that no functions are exported - the library is simply not prepared for that.

I don't known Delphi very well, but if it is possible to use the static version of libember_slim, you're fine. If this is not possible, i recommend to add the required declarations by your self (see link below). In the following section i try to explain how to build libember_slim in any possible variant (static, shared / debug, release).

Prerequisites:
1. Install premake, http://industriousone.com/premake/
2. Install Visual Studio (a trial or the community/express edition), http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx

Build:
1. Download and extract the latest package of the Ember+ libraries (or check it out with SVN)
2. Open a terminal window
3. Change to the directory chosen in step 3 (where the Ember+ libraries are)
4. Type premake4.exe vs2012 and press enter
5. Type MSBuild.exe "build\EmberPlus SDK.sln" /property:Configuration=ReleaseStatic and press enter

Notes:
- The Configuration can be DebugStatic, ReleaseStatic, DebugShared and ReleaseShared
- Add the directories of premake4.exe and MSBuild.exe to the Path environment variable
- The latest beta version of premake has some problems when generating solution/project files for Visual Studio 2013. Just generate for the previous version and upgrade the solution/project files if needed if you're using the beta.

Here you'll find how to export functions from a Windows DLL: http://msdn.microsoft.com/en-us/library/z4zxe9k8.aspx
For simplicity, i recommend using a DEF-file. You can use the Dependency Walker (http://www.dependencywalker.com) to check which functions are really exported.

I hope these steps will help you to get your project running.

Regards
Simon

Torben Weibert

unread,
Dec 3, 2014, 5:59:12 AM12/3/14
to ember-plus-...@googlegroups.com
Hi Simon,

thanks for your reply. Using premake and Visual Studio 2013 Express, I was able to build the DLL successfully (luckily the DebugShared and ReleaseShared target are already there).

I'm not familiar with the library at all yet, so I cannot tell which functions are required for export, and which functions are only used internally. I had hoped the developer knew ;)

Anyway, my strategy is to export _all_ functions initially, which I did by adding appropriate export declarations to all functions. Now I have a libember_slim.dll with 126 exported functions. I'm pretty sure that most functions are not required for export, but I will remove them later when I'm more familiar with the whole thing.

Second step was to convert all C header files to Delphi units, which I did last night and this morning. Hint for all Delphi developers, this tool saved my life: http://rvelthuis.de/programs/convertpack.html

Now I'm ready to port the sample consumer from libember_slim to Delphi to test the bindings. Unfortunately the only provider that I have access to right now is a trial version of JADE Studio running on my studio computer. There are no build files for the sample provider, and the TinyEmber VC project file doesn't work either in VS2013, I'm getting strange "cmd.exe returned error code ..." when trying to build them.

So does anybody have a Windows binary of a sample provider that I can develop against? Would be much appreciated.


Thanks

Torben

nullable.type

unread,
Dec 3, 2014, 6:34:41 AM12/3/14
to ember-plus-...@googlegroups.com
Hi Torben

Thanks for feedback!

In the download package of the Ember+ libraries, there is a prebuilt binary of the TinyEmberPlus sample provider. It is a bit hidden in the tools  folder, inside the TinyEmberPlus-2.10.10.0.zip (in the package version 1.6.2).

Regards
Simon

Torben Weibert

unread,
Dec 3, 2014, 6:36:58 AM12/3/14
to ember-plus-...@googlegroups.com
Hi Simon,

ah, great - didn't notice that one. I'll give it a try and let you know how I get along.


Thanks so far

Torben
Reply all
Reply to author
Forward
0 new messages