Question

FME Pluginbuilder Function C++

  • 18 December 2012
  • 6 replies
  • 14 views

Badge +7
Hi,

 

 

has anyone ever tried to build a FME function with C++ and using MinGW (gcc 4.7.2) instead of VS as compiler?

 

 

This is how far i got with the included CenterOfMass sample:

 

- DevC++ builds the CenterOfMass_func.dll and can link it. I only had to add on additional header file (sdtlib.h) to make size_t available.

 

- FME recognizes the dll and loads it, i see the statement about the correct API version in the log

 

- i can do cout outputs i both the createFunction- and destroyFunction, so FME has loaded the module and does use both.

 

- it does not seem FME enters the execute function at all. I've put a cout in the first line but it does not get printed

 

- I've tried using the function with both FMEFunctionCaller and CenterOfMass transformer

 

 

I've not succeded to get GDB working correctly and placing break points in the code, so for now i'v just doing printing those debug statements.

 

 

Any C++ experts out here? And yeah, i know there is a free VS edition and most likely the sample will work out of the box with it, but this would be no fun at all ;) !

6 replies

Userlevel 3
Badge +17
Hi, Tino

 

 

I tried to build CenterOfMass by Dev-C++, the result was same as yours. I guess that the not-glad result was caused by the difference of class alignment between gcc and VC.   > but this would be no fun at all ;) I agree, but it seems difficult to build FME plug-ins by gcc (:-(
Badge +21
Have anyone tried using Eclipse to build FME-plugins?
Userlevel 3
Badge +17
Hi,

 

 

I've built an emulation program on which that unexpected behavior reappears. If you are interested in it, download this. https://www.dropbox.com/s/wk4rpsohmrosedm/Emulate_FME_Function.zip   "bin" folder includes: caller.exe func_vc.dll (built with VS2010) func_gcc.dll (built with gcc 4.7.0, Dev-C++)   Try "caller -vc" and "caller -gcc" on Windows command prompt. Download includes all source files, VS project and Dev-C++ project.  
Badge +7
Hi Takashi,

 

 

that demo is pretty nice. It shows exactly what i am experiencing. The CenterOfMass runs out of the box when compiled with VS2010 and it fails to reach the execute method with gcc 4.7.

 

 

It would be nice if someone from Safe could answer, if:

 

- it is strictly not possible to compile a working DLL with gcc for FME (on Windows)

 

- or if it just requires some special compiler and/or linker options or perhaps a specific gcc version.
Badge
This is just a thought, and not knowing the details of what you're trying to do, then I might be totally off track, but VS is most likely compiling for .NET, whereas GCC compiles to machine code. From memory when I installed FME it installed the VC++ runtime environment, so I think FME might be running some .NET. I suppose there could be some sort of compatibility problem running a normal dll from the .NET engine?? However I've used normal dll's in both GCC compiled apps and .NET apps before and they've worked, though I've had more trouble using them with GCC compiled apps than .NET ones.
Userlevel 3
Badge +17
FME may be using .NET architecture in some parts. But the protocol between FME and C++-based plug-ins seems to be established on the primitive machine code generated with native C++ compiler. In my testing about the dll built with gcc, although the dll-export-functions were called successfully by main program, using virtual-functions of the object created dynamically in the dll failed. So, I suppose that the main subject would be the difference of "vtable" implementation between VC and gcc. This is an interesting issue, but it will be good to use VS obediently for actual works...

 

 

Reply