IPB

Welcome Guest ( Log In | Register )

> foobar2000 Development Forum Rules

This forum is for developer discussions only. If you have a problem / bug report / idea / feature request that isn't related to foobar2000 SDK, post it in an appropiate forum instead - tech support questions go to support forum, everything else goes to general forum.
All non-developer posts on this forum will be removed. Continued abuse of this forum will result in admin actions (warnings, account suspension).

C++/CLI component
jonpb
post Mar 17 2013, 05:07
Post #1





Group: Members
Posts: 122
Joined: 21-August 06
Member No.: 34268



Hi,
My goal is to write a WCF service to expose playback_control and playlist_manager in order write a winrt player using foobar2000 as the backend. This requires a C++ to .NET bridge. I was hoping to use a combination of reverse p/invoke and C++/CLI aggregation/composition to accomplish this.

The inititquit implementation is straight up inheritance coupled with initquit_factory_t. This works fine with reverse p/invoke.

I'm puzzled with the playback_control implementation which seems to use composition on the C++ side via static_api_ptr_t<playback_control>. This should not be a problem to then use composition on the C++/CLI side except for the fact that when I include foobar2000.h in a .cpp compilation unit compiling with the /clr switch I get the following errors:

Before initguit::on_init
First-chance exception at 0x75204b32 in foobar2000.exe: Microsoft C++ exception: foobar2000_io::exception_io_data_truncation at memory location 0x0031e91c.
First-chance exception at 0x75204b32 in foobar2000.exe: Microsoft C++ exception: foobar2000_io::exception_io_not_found at memory location 0x0031e940.
First-chance exception at 0x75204b32 in foobar2000.exe: Microsoft C++ exception: foobar2000_io::exception_io_not_found at memory location 0x0031e940.

initguit::on_init gets called and everytings seems ok, then I close the application

On exit of the application:
First-chance exception at 0x75204b32 in foobar2000.exe: 0xC0020001: The string binding is invalid.
Unhandled exception at 0x75204b32 in foobar2000.exe: 0xC0020001: The string binding is invalid.

And it crashes Visual Studio bad, I have to restart the IDE.

Any ideas to solve this? Am I using playback_control correctly? I created a C++ wrapper class which just forwards each function call to the aggregate member static_api_ptr_t<playback_control>.

EDIT: Just to clarify, I need to declare wcf service class objects in the on_init implementation and unfortunately wcf requires instantiable objects in these methods, interfaces are not allowed, thus the problem of requiring to #include foobar2000.h in the /clr compilation unit which implements the service. If I can use the "factory" paradigm for playback_control like is used for initquit perhaps I can use reverse p/invoke for these interfaces?

Thanks.

This post has been edited by jonpb: Mar 17 2013, 05:35
Go to the top of the page
+Quote Post
 
Start new topic
Replies
jonpb
post Mar 30 2013, 01:41
Post #2





Group: Members
Posts: 122
Joined: 21-August 06
Member No.: 34268



Awesome, I had no idea you had compiled a doxygen help system. Thanks again Foosion.
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 31st August 2014 - 06:27