Csound Csound-dev Csound-tekno Search About

[Csnd] Plugin development questions

Date2013-08-03 13:09
FromSimonKenny
Subject[Csnd] Plugin development questions
Hi

I'm working on a Leap Motion (http://leapmotion.com) plugin for Csound. I
have a few questions about issues I'm having and I would be very grateful
for any help anyone would have.

Firstly, the latest version of my plugin builds on OSX using the Xcode
system for Csound 5.2 and works fine when included at runtime via the
--opcode-lib flag. However when I updated the system to Csound 6, I can
build the plugin with the new headers and dylib library, but I get a API
version mismatch error when I include at runtime. It's giving me version
(2.6/3.0) mismatch. I checked that the API version in the new version.h file
was 3.0 and it is. I even changed this value to 2.6 in version.h, rebuilt to
check it Csound 6 is expecting the wrong API level for some reason.
Strangely it doesn't give an error when included, it seems to just skip it
entirely. Any idea what I'm doing wrong? Also note that I completely removed
Csound 5.2 so the new installation was clean.

Secondly, I've never been able to get it working on a Windows system. I was
able to build my plugin, using the pthread-win32 library as a pthread
substitute (I notice Csound comes with the GCC pthread-win32 dll on Windows
so this must be what you use too). However I get a system hang after
"Loading command-line libraries:" stdout message.

I investigated using the Dr. Memory tool but don't really know how to
interpret the results. In case anyone does know I can post the log file,
which has lots of "uninitialized read" errors with call traces. Here's an
example:

Error #39: UNINITIALIZED READ: reading 0x0028f6d1-0x0028f6d8 7 byte(s)
within 0x0028f6d0-0x0028f6d8
# 0 Leap.dll!Leap::Listener::onDisconnect                    +0x1a326 
(0x50b6b436 )
# 1 Leap.dll!Leap::Listener::onDisconnect                    +0x1a41a 
(0x50b6b52b )
# 2 Leap.dll!Leap::HandList::operator[]                      +0x4c8b  
(0x50c1662c )
# 3 Leap.dll!Leap::Controller::Controller                    +0x168   
(0x50c17c89 )
# 4 libLeapIntoCsound.dll!`dynamic initializer for 'leapHandUpdater''
[c:\users\windows7\documents\visual studio
2010\projects\libleapintocsound\libleapintocsound\leapintocsound.cpp:443]
# 5 MSVCR100.dll!initterm                                    +0x15    
(0x7231263d )
# 6 libLeapIntoCsound.dll!_CRT_INIT                          
[f:\dd\vctools\crt_bld\self_x86\crt\src\crtdll.c:284]
# 7 libLeapIntoCsound.dll!__DllMainCRTStartup                
[f:\dd\vctools\crt_bld\self_x86\crt\src\crtdll.c:506]
# 8 libLeapIntoCsound.dll!_DllMainCRTStartup                 
[f:\dd\vctools\crt_bld\self_x86\crt\src\crtdll.c:476]
# 9 ntdll.dll!RtlQueryEnvironmentVariable                    +0x240   
(0x776a9950 )
#10 ntdll.dll!LdrResSearchResource                           +0xb4c   
(0x776ad8c9 )
#11 ntdll.dll!LdrResSearchResource                           +0xa0f   
(0x776ad78c )
Note: @0:01:20.562 in thread 5700
Note: instruction: movq   0x40(%esp) -> %xmm0


My guess is that it could be one of these: (i) I'm using the wrong version
of pthread-win32, the visual studio version, and it doesn't like being used
alongside the GCC version, (ii) the Leap Motion API uses Boost threads, and
even though these wrap the native windows threads, they're not playing nice
together, or (iii) I've made an error when building my plugin dll.

Sorry for such a long post as my first one here, I hope that's not bad
manners!
Thank you for your time.

Simon



--
View this message in context: http://csound.1045644.n5.nabble.com/Plugin-development-questions-tp5726280.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-08-03 13:45
FromMichael Gogins
SubjectRe: [Csnd] Plugin development questions
Are you writing in C or C++? If C++, the vendor and version of the compiler must be the same for all C++ components (C mixes and matches much better).

GCC, if that's what you're using, comes in four different models on WIndows, setjump-longjump exception handling vs dwarf2 exception handling, and then also Windows threads vs Posix threads. Oh, and there's 32 bit vs64 bit architecture.

Assuming you're using 32 bit architecture, you WILL have problems if one part uses sjlj and the other dw2, and you MAY have problems if one part uses Posix threads and the other Win32 threads.

The pthread-win32 library itself may be a problem. Recently the type of pthread_t itself changed (was two words in size, now is one word in size).


===========================
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Sat, Aug 3, 2013 at 8:09 AM, SimonKenny <digithree@gmail.com> wrote:
Hi

I'm working on a Leap Motion (http://leapmotion.com) plugin for Csound. I
have a few questions about issues I'm having and I would be very grateful
for any help anyone would have.

Firstly, the latest version of my plugin builds on OSX using the Xcode
system for Csound 5.2 and works fine when included at runtime via the
--opcode-lib flag. However when I updated the system to Csound 6, I can
build the plugin with the new headers and dylib library, but I get a API
version mismatch error when I include at runtime. It's giving me version
(2.6/3.0) mismatch. I checked that the API version in the new version.h file
was 3.0 and it is. I even changed this value to 2.6 in version.h, rebuilt to
check it Csound 6 is expecting the wrong API level for some reason.
Strangely it doesn't give an error when included, it seems to just skip it
entirely. Any idea what I'm doing wrong? Also note that I completely removed
Csound 5.2 so the new installation was clean.

Secondly, I've never been able to get it working on a Windows system. I was
able to build my plugin, using the pthread-win32 library as a pthread
substitute (I notice Csound comes with the GCC pthread-win32 dll on Windows
so this must be what you use too). However I get a system hang after
"Loading command-line libraries:" stdout message.

I investigated using the Dr. Memory tool but don't really know how to
interpret the results. In case anyone does know I can post the log file,
which has lots of "uninitialized read" errors with call traces. Here's an
example:

Error #39: UNINITIALIZED READ: reading 0x0028f6d1-0x0028f6d8 7 byte(s)
within 0x0028f6d0-0x0028f6d8
# 0 Leap.dll!Leap::Listener::onDisconnect                    +0x1a326
(0x50b6b436 <Leap.dll+0x1b436>)
# 1 Leap.dll!Leap::Listener::onDisconnect                    +0x1a41a
(0x50b6b52b <Leap.dll+0x1b52b>)
# 2 Leap.dll!Leap::HandList::operator[]                      +0x4c8b
(0x50c1662c <Leap.dll+0xc662c>)
# 3 Leap.dll!Leap::Controller::Controller                    +0x168
(0x50c17c89 <Leap.dll+0xc7c89>)
# 4 libLeapIntoCsound.dll!`dynamic initializer for 'leapHandUpdater''
[c:\users\windows7\documents\visual studio
2010\projects\libleapintocsound\libleapintocsound\leapintocsound.cpp:443]
# 5 MSVCR100.dll!initterm                                    +0x15
(0x7231263d <MSVCR100.dll+0x1263d>)
# 6 libLeapIntoCsound.dll!_CRT_INIT
[f:\dd\vctools\crt_bld\self_x86\crt\src\crtdll.c:284]
# 7 libLeapIntoCsound.dll!__DllMainCRTStartup
[f:\dd\vctools\crt_bld\self_x86\crt\src\crtdll.c:506]
# 8 libLeapIntoCsound.dll!_DllMainCRTStartup
[f:\dd\vctools\crt_bld\self_x86\crt\src\crtdll.c:476]
# 9 ntdll.dll!RtlQueryEnvironmentVariable                    +0x240
(0x776a9950 <ntdll.dll+0x39950>)
#10 ntdll.dll!LdrResSearchResource                           +0xb4c
(0x776ad8c9 <ntdll.dll+0x3d8c9>)
#11 ntdll.dll!LdrResSearchResource                           +0xa0f
(0x776ad78c <ntdll.dll+0x3d78c>)
Note: @0:01:20.562 in thread 5700
Note: instruction: movq   0x40(%esp) -> %xmm0


My guess is that it could be one of these: (i) I'm using the wrong version
of pthread-win32, the visual studio version, and it doesn't like being used
alongside the GCC version, (ii) the Leap Motion API uses Boost threads, and
even though these wrap the native windows threads, they're not playing nice
together, or (iii) I've made an error when building my plugin dll.

Sorry for such a long post as my first one here, I hope that's not bad
manners!
Thank you for your time.

Simon



--
View this message in context: http://csound.1045644.n5.nabble.com/Plugin-development-questions-tp5726280.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2013-08-03 17:03
FromVictor Lazzarini
SubjectRe: [Csnd] Plugin development questions
The plugin version comes solely from the CsoundLib headers (there is no linkage involved), so it is a matter
of making sure you are using the correct headers. It does look like you might have the wrong header
included.

You can simplify the build by doing it from the command-line:

g++ -O3 -dynamiclib -o opcode.dylib  yourcode.cpp  -DUSE_DOUBLE  -I  -L  

Victor
On 3 Aug 2013, at 13:09, SimonKenny wrote:

> Firstly, the latest version of my plugin builds on OSX using the Xcode
> system for Csound 5.2 and works fine when included at runtime via the
> --opcode-lib flag. However when I updated the system to Csound 6, I can
> build the plugin with the new headers and dylib library, but I get a API
> version mismatch error when I include at runtime. It's giving me version
> (2.6/3.0) mismatch. I checked that the API version in the new version.h file
> was 3.0 and it is. I even changed this value to 2.6 in version.h, rebuilt to
> check it Csound 6 is expecting the wrong API level for some reason.
> Strangely it doesn't give an error when included, it seems to just skip it
> entirely. Any idea what I'm doing wrong? Also note that I completely removed
> Csound 5.2 so the new installation was clean.

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Date2013-08-05 21:50
FromSimonKenny
Subject[Csnd] Re: Plugin development questions
Thanks, I will try that tomorrow.



--
View this message in context: http://csound.1045644.n5.nabble.com/Plugin-development-questions-tp5726280p5726359.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-08-05 21:59
FromSimonKenny
Subject[Csnd] Re: Plugin development questions
@Micheal

I am using Visual Studio 2010 on the Windows machine to build the plugin. I
know that the Leap library works fine using the VSC++ compiler. Do I need to
use the same compiler that Csound was built in? If so, it that one of the
GCC ports like MinGW? I got the prebuilt installer for Windows when I
installed Csound 6.

Thanks for your time



--
View this message in context: http://csound.1045644.n5.nabble.com/Plugin-development-questions-tp5726280p5726361.html
Sent from the Csound - General mailing list archive at Nabble.com.