What is a way to determine if an external plugin has been loaded?
Couldn't find this on the swiki. I see that the plugin has make'd and copied to the proper system dir along with the other plugins. But, my one primitive fails (which doesn't do much). I'm assuming that the plugin hasn't loaded (there is no initialization but I'm using Slang) brad -- Brad Fuller (408) 799-6124 ** Sonaural Audio Studios ** (408) 799-6123 West San Jose (408) 799-6124 Cambrian ________________________________ Hear us online: www.Sonaural.com See me on O'Reilly: http://www.oreillynet.com/pub/au/2184 |
Am 11.11.2005 um 21:41 schrieb Brad Fuller: > What is a way to determine if an external plugin has been loaded? > Couldn't find this on the swiki. Smalltalk listLoadedModules > I see that the plugin has make'd and copied to the proper system > dir along with the other plugins. > But, my one primitive fails (which doesn't do much). I'm assuming > that the plugin hasn't loaded (there is no initialization but I'm > using Slang) Modules are loaded only on demand, not at start up. - Bert - |
In reply to this post by Brad Fuller
tim Rowledge wrote:
> > On 11-Nov-05, at 12:41 PM, Brad Fuller wrote: > >> What is a way to determine if an external plugin has been loaded? >> Couldn't find this on the swiki. > > Smalltalk listLoadedModules will tell you all the modules actually > loaded *and in use* whether they are external or internal. Thanks, Tim and Burt! My primitive merely calls a cross platform file that plays a sine wave, entirely in C, for 5 seconds and then returns. I think the problem is that it can't find an external library. I receive this: $ ioLoadModule(/usr/local/lib/squeak/3.7-7/SoundPAPlugin): /usr/local/lib/squeak/3.7-7/SoundPAPlugin: undefined symbol: Pa_GetDeviceInfo Pa_GetDeviceInfo is in a library accessible to all (usr/local/lib/libportaudio.so). All of this works fine externally: i.e. the sine wave plays from the command line (of course, when I make the file with a main()). I call Pa_GetDeviceInfo from a Cross platform file: patest_sine.c file. I can see that both of my files compiled fine and landed in the 'src' directory: SoundPAPlugin.o patest_sine.o I assume these are linked and placed in: /usr/local/lib/squeak/3.7-7/SoundPAPlugin I further assume, that since the error reported is about Pa_GetDeviceInfo, the plugin is being called, but it can't find the library where Pa_GetDeviceInfo resides: usr/local/lib/libportaudio.so. Do I need to do something different with external libraries -- even though the system knows all about them? brad |
Am 11.11.2005 um 22:46 schrieb Brad Fuller: > > $ ioLoadModule(/usr/local/lib/squeak/3.7-7/SoundPAPlugin): > /usr/local/lib/squeak/3.7-7/SoundPAPlugin: undefined symbol: > Pa_GetDeviceInfo > > Pa_GetDeviceInfo is in a library accessible to all (usr/local/lib/ > libportaudio.so). You need to link libportaudio.so into SoundPAPlugin. - Bert - |
Bert Freudenberg wrote:
> > Am 11.11.2005 um 22:46 schrieb Brad Fuller: > >> >> $ ioLoadModule(/usr/local/lib/squeak/3.7-7/SoundPAPlugin): >> /usr/local/lib/squeak/3.7-7/SoundPAPlugin: undefined symbol: >> Pa_GetDeviceInfo >> >> Pa_GetDeviceInfo is in a library accessible to all (usr/local/lib/ >> libportaudio.so). > > > You need to link libportaudio.so into SoundPAPlugin. > > - yeah, I thought I did. I'll just have to see if I did that wrong. I never saw an error. Thanks! brad |
In reply to this post by Bert Freudenberg-3
Bert Freudenberg wrote:
> > Am 11.11.2005 um 22:46 schrieb Brad Fuller: > >> >> $ ioLoadModule(/usr/local/lib/squeak/3.7-7/SoundPAPlugin): >> /usr/local/lib/squeak/3.7-7/SoundPAPlugin: undefined symbol: >> Pa_GetDeviceInfo >> >> Pa_GetDeviceInfo is in a library accessible to all (usr/local/lib/ >> libportaudio.so). > > > You need to link libportaudio.so into SoundPAPlugin. doh! I was wrong. And, I can't figure out how slip in a library link so that I don't have to create a custom makefile. I see from the documentation that you can use m4 macros or a makefile.inc file. But, I can't figure out how to do it. Any pointers to docs would be much appreciated. Do you have any examples? -- Brad Fuller (408) 799-6124 ** Sonaural Audio Studios ** (408) 799-6123 West San Jose (408) 799-6124 Cambrian ________________________________ Hear us online: www.Sonaural.com See me on O'Reilly: http://www.oreillynet.com/pub/au/2184 |
In reply to this post by Bert Freudenberg-3
Bert Freudenberg wrote:
> Am 11.11.2005 um 21:41 schrieb Brad Fuller: >> What is a way to determine if an external plugin has been loaded? >> Couldn't find this on the swiki. > > Smalltalk listLoadedModules Better to write a primitive which never fails. Not only do you know it's been loaded, you can also put version information into it. Cheers, - Andreas |
In reply to this post by Brad Fuller
Am 12.11.2005 um 01:12 schrieb Brad Fuller: > Bert Freudenberg wrote: > >> >> Am 11.11.2005 um 22:46 schrieb Brad Fuller: >> >>> >>> $ ioLoadModule(/usr/local/lib/squeak/3.7-7/SoundPAPlugin): >>> /usr/local/lib/squeak/3.7-7/SoundPAPlugin: undefined symbol: >>> Pa_GetDeviceInfo >>> >>> Pa_GetDeviceInfo is in a library accessible to all (usr/local/ >>> lib/ libportaudio.so). >> >> >> You need to link libportaudio.so into SoundPAPlugin. > > doh! I was wrong. > And, I can't figure out how slip in a library link so that I don't > have to create a custom makefile. > I see from the documentation that you can use m4 macros or a > makefile.inc file. But, I can't figure out how to do it. > Any pointers to docs would be much appreciated. Do you have any > examples? Sure: platforms/unix/plugins % grep PLIBS */Makefile.inc ObjectiveCPlugin/Makefile.inc:PLIBS= -Wl,-framework -Wl,Foundation ... which is used in: platforms/unix/plugins % egrep -v '^(#|$)' ../config/Makefile.plg.in [make_cfg] [make_plg] XINCLUDES = [includes] OBJS = [targets] TARGET = [target] PLIBS = [plibs] [make_inc] $(TARGET) : $(OBJS) Makefile $(LINK) $(TARGET) $(OBJS) $(PLIBS) $(RANLIB) $(TARGET) [make_targets] .force : - Bert - |
Bert Freudenberg wrote:
> > Am 12.11.2005 um 01:12 schrieb Brad Fuller: > >> Bert Freudenberg wrote: >> >>> >>> Am 11.11.2005 um 22:46 schrieb Brad Fuller: >>> >>>> >>>> $ ioLoadModule(/usr/local/lib/squeak/3.7-7/SoundPAPlugin): >>>> /usr/local/lib/squeak/3.7-7/SoundPAPlugin: undefined symbol: >>>> Pa_GetDeviceInfo >>>> >>>> Pa_GetDeviceInfo is in a library accessible to all (usr/local/ >>>> lib/ libportaudio.so). >>> >>> >>> >>> You need to link libportaudio.so into SoundPAPlugin. >> >> >> doh! I was wrong. >> And, I can't figure out how slip in a library link so that I don't >> have to create a custom makefile. >> I see from the documentation that you can use m4 macros or a >> makefile.inc file. But, I can't figure out how to do it. >> Any pointers to docs would be much appreciated. Do you have any >> examples? > > > Sure: > > platforms/unix/plugins % grep PLIBS */Makefile.inc > ObjectiveCPlugin/Makefile.inc:PLIBS= -Wl,-framework -Wl,Foundation > > ... which is used in: > > platforms/unix/plugins % egrep -v '^(#|$)' ../config/Makefile.plg.in > [make_cfg] > [make_plg] > XINCLUDES = [includes] > OBJS = [targets] > TARGET = [target] > PLIBS = [plibs] > [make_inc] > $(TARGET) : $(OBJS) Makefile > $(LINK) $(TARGET) $(OBJS) $(PLIBS) > $(RANLIB) $(TARGET) > [make_targets] > .force : Thanks Bert, that's what I tried, but I forget to use "Wl". So, I tried that but I still can't get the macros to work. I really have two problems that maybe you've seen. ** Problem 1: I've placed: PLIBS=Wl,-L/usr/local/lib/ Wl,-llibportaudio.so in Makefile.inc deleted Makefile, run config/configure (to create the Makefile) And the PLIBS = line is still empty. Don't know what to do about that. ==== My second, more important problem, is I still get the runtime error when manually editing the Makefile by placing: PLIBS = Wl,-L/usr/local/lib/ Wl,-llibportaudio.so (I assume I need to pass the location with -L and the file with -l) During the link phase of the make, it seems to link ok, with no errors. And after "make install" I try the plugin in Squeak and I still receive the error: ioLoadModule(/usr/local/lib/squeak/3.7-7/SoundPAPlugin): /usr/local/lib/squeak/3.7-7/SoundPAPlugin: undefined symbol: Pa_GetDeviceInfo I'm not familiar with what format the switches should be in to be passed from libtool to ld. So, I tried just: PLIBS = -Wl,/usr/local/lib/libportaudio.so (without the '-l') and that made a bit of progress. I didn't get the "undefined symbol at runtime. However, I got a segmentation fault immediately. :-( It know my external file in the Cross directory was called because I have a printf in the file that did print to the console and it printed. After the segfault, was a log that didn't make much sense. Here's the top: == PortAudio Test: output sine wave. SR = 44100, BufSize = 64 Segmentation fault 2036700292 UndefinedObject>DoIt 2036668572 Compiler>evaluate:in:to:notifying:ifFail:logged: 2036669032 [] in ParagraphEditor>evaluateSelection 2036668388 BlockContext>on:do: 2036668296 ParagraphEditor>evaluateSelection 2036641436 [] in PluggableTextMorph>doIt 2036656868 [] in PluggableTextMorph>handleEdit: 2036656368 TextMorph>handleEdit: 2036640792 PluggableTextMorph>handleEdit: 2036640516 PluggableTextMorph>doIt 2036640424 StringHolder>perform:orSendTo: == So maybe * the library is made wrong? It's a shared library. * Maybe I didn't set up the plugin (or primitive) correctly? * Maybe Squeak can't wait for a bit to play a sine wave. I didn't set up any buffers in Squeak so I can't see how any garbage collection would be a problem. This is a big problem, so I probably did something obviously wrong. Any ideas or pointers where to look is much appreciated. Thanks for your help! brad |
In reply to this post by Andreas.Raab
On 11-Nov-05, at 8:17 PM, Andreas Raab wrote: > Bert Freudenberg wrote: >> Am 11.11.2005 um 21:41 schrieb Brad Fuller: >>> What is a way to determine if an external plugin has been >>> loaded? Couldn't find this on the swiki. >> Smalltalk listLoadedModules > > Better to write a primitive which never fails. Not only do you know > it's been loaded, you can also put version information into it. No need; the module name that you will get back from Smalltalk listLoadedModules can include version info. See implementors of #moduleNameAndVersion and in particular the LargeIntegersPlugin version. Of course, you will pay the cost of getting all the info for all loaded plugins when using this. In some cases it may be important to find a plugin version quickly and then an extra prim in the plugin is possibly useful. However I don't think I would suggest following the bizarre usage of LargeIntegersPlugin>primGetModuleName and primCheckIfCModuleExists tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim |
In reply to this post by Brad Fuller
Brad Fuller wrote:
> Bert Freudenberg wrote: > >> >> Am 12.11.2005 um 01:12 schrieb Brad Fuller: >> >>> Bert Freudenberg wrote: >>> >>>> >>>> Am 11.11.2005 um 22:46 schrieb Brad Fuller: >>>> >>>>> >>>>> $ ioLoadModule(/usr/local/lib/squeak/3.7-7/SoundPAPlugin): >>>>> /usr/local/lib/squeak/3.7-7/SoundPAPlugin: undefined symbol: >>>>> Pa_GetDeviceInfo >>>>> >>>>> Pa_GetDeviceInfo is in a library accessible to all (usr/local/ >>>>> lib/ libportaudio.so). >>>> >>>> >>>> >>>> >>>> You need to link libportaudio.so into SoundPAPlugin. >>> >>> >>> >>> doh! I was wrong. >>> And, I can't figure out how slip in a library link so that I don't >>> have to create a custom makefile. >>> I see from the documentation that you can use m4 macros or a >>> makefile.inc file. But, I can't figure out how to do it. >>> Any pointers to docs would be much appreciated. Do you have any >>> examples? >> >> >> >> Sure: >> >> platforms/unix/plugins % grep PLIBS */Makefile.inc >> ObjectiveCPlugin/Makefile.inc:PLIBS= -Wl,-framework -Wl,Foundation >> >> ... which is used in: >> >> platforms/unix/plugins % egrep -v '^(#|$)' ../config/Makefile.plg.in >> [make_cfg] >> [make_plg] >> XINCLUDES = [includes] >> OBJS = [targets] >> TARGET = [target] >> PLIBS = [plibs] >> [make_inc] >> $(TARGET) : $(OBJS) Makefile >> $(LINK) $(TARGET) $(OBJS) $(PLIBS) >> $(RANLIB) $(TARGET) >> [make_targets] >> .force : > > > Thanks Bert, that's what I tried, but I forget to use "Wl". So, I > tried that but I still can't get the macros to work. > > I really have two problems that maybe you've seen. > > ** Problem 1: > I've placed: > PLIBS=Wl,-L/usr/local/lib/ Wl,-llibportaudio.so > in Makefile.inc > > deleted Makefile, run config/configure (to create the Makefile) > And the PLIBS = line is still empty. > > Don't know what to do about that. > > ==== > My second, more important problem, is I still get the runtime error > when manually editing the Makefile by placing: > PLIBS = Wl,-L/usr/local/lib/ Wl,-llibportaudio.so > > (I assume I need to pass the location with -L and the file with -l) > > During the link phase of the make, it seems to link ok, with no errors. > And after "make install" I try the plugin in Squeak and I still > receive the error: > ioLoadModule(/usr/local/lib/squeak/3.7-7/SoundPAPlugin): > /usr/local/lib/squeak/3.7-7/SoundPAPlugin: undefined symbol: > Pa_GetDeviceInfo > > I'm not familiar with what format the switches should be in to be > passed from libtool to ld. So, I tried just: > PLIBS = -Wl,/usr/local/lib/libportaudio.so > (without the '-l') and that made a bit of progress. I didn't get the > "undefined symbol at runtime. > > However, I got a segmentation fault immediately. :-( > It know my external file in the Cross directory was called because I > have a printf in the file that did print to the console and it printed. > After the segfault, was a log that didn't make much sense. Here's the > top: > == > PortAudio Test: output sine wave. SR = 44100, BufSize = 64 > > Segmentation fault > > 2036700292 UndefinedObject>DoIt > 2036668572 Compiler>evaluate:in:to:notifying:ifFail:logged: > 2036669032 [] in ParagraphEditor>evaluateSelection > 2036668388 BlockContext>on:do: > 2036668296 ParagraphEditor>evaluateSelection > 2036641436 [] in PluggableTextMorph>doIt > 2036656868 [] in PluggableTextMorph>handleEdit: > 2036656368 TextMorph>handleEdit: > 2036640792 PluggableTextMorph>handleEdit: > 2036640516 PluggableTextMorph>doIt > 2036640424 StringHolder>perform:orSendTo: > == > > So maybe > * the library is made wrong? It's a shared library. > * Maybe I didn't set up the plugin (or primitive) correctly? > * Maybe Squeak can't wait for a bit to play a sine wave. I didn't set > up any buffers in Squeak so I can't see how any garbage collection > would be a problem. > > This is a big problem, so I probably did something obviously wrong. > > Any ideas or pointers where to look is much appreciated. > > Thanks for your help! I now assume I rcv'd the segfault because I didn't have the jackd running. After starting up jackd and running the test from squeak, the computer locks up for about 30secs. then it comes alive again after Squeak dies. The console output is: Killed Which I assume is from Squeak. Still, this problem might be an interaction between Squeak and portaudio library. Don't know what it could be though. And still a serious problem. BTW, I probably should have copied the complete Squeak dump (when jackd wasn't running). Here it is for history: === PortAudio Test: output sine wave. SR = 44100, BufSize = 64 Segmentation fault 2037525692 UndefinedObject>DoIt 2037493972 Compiler>evaluate:in:to:notifying:ifFail:logged: 2037494432 [] in ParagraphEditor>evaluateSelection 2037493788 BlockContext>on:do: 2037493696 ParagraphEditor>evaluateSelection 2037466836 [] in PluggableTextMorph>doIt 2037482268 [] in PluggableTextMorph>handleEdit: 2037481768 TextMorph>handleEdit: 2037466192 PluggableTextMorph>handleEdit: 2037465916 PluggableTextMorph>doIt 2037465824 StringHolder>perform:orSendTo: 2037465456 [] in MenuItemMorph>invokeWithEvent: 2037465180 BlockContext>ensure: 2037465088 Cursor>showWhile: 2037364312 MenuItemMorph>invokeWithEvent: 2037364204 MenuItemMorph>mouseUp: 2037364112 MenuItemMorph>handleMouseUp: 2037363880 MouseButtonEvent>sentTo: 2037363788 Morph>handleEvent: 2037363696 MorphicEventDispatcher>dispatchDefault:with: 2037363604 MorphicEventDispatcher>dispatchEvent:with: 2037363512 Morph>processEvent:using: 2037363420 MorphicEventDispatcher>dispatchDefault:with: 2037363312 MorphicEventDispatcher>dispatchEvent:with: 2037363180 Morph>processEvent:using: 2037363088 Morph>processEvent: 2037362996 MenuMorph>handleFocusEvent: 2037362720 [] in HandMorph>sendFocusEvent:to:clear: 2037362812 [] in PasteUpMorph>becomeActiveDuring: 2037362628 BlockContext>on:do: 2037362536 PasteUpMorph>becomeActiveDuring: 2037362352 HandMorph>sendFocusEvent:to:clear: 2037362260 HandMorph>sendEvent:focus:clear: 2037362116 HandMorph>sendMouseEvent: 2037362024 HandMorph>handleEvent: 2037361724 HandMorph>processEvents 2037361816 [] in WorldState>doOneCycleNowFor: 2037361632 SequenceableCollection>do: 2037361540 WorldState>handsDo: 2037361448 WorldState>doOneCycleNowFor: 2037361356 WorldState>doOneCycleFor: 2037361264 WorldState>doOneSubCycleFor: 2037361172 PasteUpMorph>doOneSubCycle 2037353224 MenuMorph>invokeModalAt:in:allowKeyboard: 2037353132 MenuMorph>invokeModal: 2037352824 MenuMorph>invokeModal 2037347456 PluggableTextMorph>yellowButtonActivity: 2037347364 TextMorphForEditView>mouseDown: 2037347268 Morph>handleMouseDown: 2037347176 MouseButtonEvent>sentTo: 2037347084 Morph>handleEvent: 2037346932 MorphicEventDispatcher>dispatchMouseDown:with: 2037346840 MorphicEventDispatcher>dispatchEvent:with: 2037346748 Morph>processEvent:using: 2037346604 MorphicEventDispatcher>dispatchMouseDown:with: 2037346460 MorphicEventDispatcher>dispatchEvent:with: 2037346368 Morph>processEvent:using: 2037346276 MorphicEventDispatcher>dispatchMouseDown:with: 2037346184 MorphicEventDispatcher>dispatchEvent:with: 2037346092 Morph>processEvent:using: 2037345880 MorphicEventDispatcher>dispatchMouseDown:with: 2037345788 MorphicEventDispatcher>dispatchEvent:with: 2037345696 Morph>processEvent:using: 2037345604 MorphicEventDispatcher>dispatchMouseDown:with: 2037345512 MorphicEventDispatcher>dispatchEvent:with: 2037345404 Morph>processEvent:using: 2037345312 PasteUpMorph>processEvent:using: 2037345128 Morph>processEvent: 2037345036 HandMorph>sendEvent:focus:clear: 2037344892 HandMorph>sendMouseEvent: 2037344800 HandMorph>handleEvent: 2037344580 HandMorph>processEvents 2037344672 [] in WorldState>doOneCycleNowFor: 2037344488 SequenceableCollection>do: 2037344396 WorldState>handsDo: 2037344304 WorldState>doOneCycleNowFor: 2037344212 WorldState>doOneCycleFor: 2037344120 PasteUpMorph>doOneCycle 2032032752 [] in Project class>spawnNewProcess 2032032936 [] in BlockContext>newProcess Aborted |
Free forum by Nabble | Edit this page |