I want to use these libraries in my (managed) .NET program. I'm using mvid's latest sources. Sadly, I can't get them to work. I've tried several things:
1. Since .NET doesn't support the FastCall calling convention, I tried recompiling all libraries using StdCall by changing the #DEFINEs in IFXAPI.h from __fastcall into __stdcall, but after succesful compilation, even the HelloWorld app crashes.
2. I wrote an unmanaged wrapper class for calling the IFXCOMInitialize, IFXCreateComponent and IFXCOMUninitialize methods. This wrapper class is able to do the fastcalls, but this also doesn't work, probably because all subsequent method calls on the components created (e.g. pCoreServices->Initialize(IFXPROFILE_BASE from HelloWorld.cpp) are also declared as __fastcall. I get tons of warnings like this: "warning C4561: '__fastcall' incompatible with the '/clr' option: converting to '__stdcall'", because the libraries are compiled with __fastcall.
Anyone has any idea what to do?
Has anyone managed to get these libraries working in a .NET app?
Regards,
Rob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> I tried recompiling all libraries using StdCall by changing the #DEFINEs in IFXAPI.h from __fastcall into __stdcall, but after succesful compilation, even the HelloWorld app crashes.
Did you try debugging?
MSVC (while debugging HelloWorld) complains at runtime "The value of ESP was not properly saved across a function call." at IFX memory allocation call and suggests that calling a routine using wrong calling convention may be the reason. I do not know anything about calling conventions, but at least that is a C++ problem. NET is completely foreign to me.
PS. If your 3D output requirements are only basic, there is an option of using PRC output routines from Asymptote project.
They fit into a couple of simple C++ files, so they can be easily adapted to your requirements.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did, and got the same error as you have encountered. BTW, compiling using __cdecl calling conventions did work, but still I can't get the libraries to work in .NET. I suppose .NET doesn't like calling methods of unmanaged objects outside the managed heap, like
pCoreServices->Initialize(IFXPROFILE_BASE)
and
pViewNode->SetSceneGraph(pSceneGraph)
, even though they ought to be properly created by the libraries. I don't know enough about .NET either to get this to work in a reasonable amount of time I'm afraid.
I think I'll check out the PRC routines you mentioned, as I only want to export not-so-complex 3D models to a 3D PDF.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I want to use these libraries in my (managed) .NET program. I'm using mvid's latest sources. Sadly, I can't get them to work. I've tried several things:
1. Since .NET doesn't support the FastCall calling convention, I tried recompiling all libraries using StdCall by changing the #DEFINEs in IFXAPI.h from __fastcall into __stdcall, but after succesful compilation, even the HelloWorld app crashes.
2. I wrote an unmanaged wrapper class for calling the IFXCOMInitialize, IFXCreateComponent and IFXCOMUninitialize methods. This wrapper class is able to do the fastcalls, but this also doesn't work, probably because all subsequent method calls on the components created (e.g. pCoreServices->Initialize(IFXPROFILE_BASE from HelloWorld.cpp) are also declared as __fastcall. I get tons of warnings like this: "warning C4561: '__fastcall' incompatible with the '/clr' option: converting to '__stdcall'", because the libraries are compiled with __fastcall.
Anyone has any idea what to do?
Has anyone managed to get these libraries working in a .NET app?
Regards,
Rob
> I tried recompiling all libraries using StdCall by changing the #DEFINEs in IFXAPI.h from __fastcall into __stdcall, but after succesful compilation, even the HelloWorld app crashes.
Did you try debugging?
MSVC (while debugging HelloWorld) complains at runtime "The value of ESP was not properly saved across a function call." at IFX memory allocation call and suggests that calling a routine using wrong calling convention may be the reason. I do not know anything about calling conventions, but at least that is a C++ problem. NET is completely foreign to me.
PS. If your 3D output requirements are only basic, there is an option of using PRC output routines from Asymptote project.
They fit into a couple of simple C++ files, so they can be easily adapted to your requirements.
Thanks for your reply mvid.
I did, and got the same error as you have encountered. BTW, compiling using __cdecl calling conventions did work, but still I can't get the libraries to work in .NET. I suppose .NET doesn't like calling methods of unmanaged objects outside the managed heap, like
and
, even though they ought to be properly created by the libraries. I don't know enough about .NET either to get this to work in a reasonable amount of time I'm afraid.
I think I'll check out the PRC routines you mentioned, as I only want to export not-so-complex 3D models to a 3D PDF.
> I think I'll check out the PRC routines you mentioned,
E-mail me at master at iaas.msu.ru for current code.
The following patch fixes __stdcall calling bug.