Image decoders fail in DLL
Image decoders fail in DLL
I tried a call in the main program, as well within the function call, and the image decoders fail to work when used in a DLL.
Here, even try this. Run it as a regular PB program, then try it as a DLL.
ProcedureDLL ImageTest(a,b,c,d)
UseJPEGImageDecoder()
result=LoadImage(0,"bankwallwindow.jpg")
MessageRequester("",Str(result),0)
EndProcedure
;imagetest()
Here, even try this. Run it as a regular PB program, then try it as a DLL.
ProcedureDLL ImageTest(a,b,c,d)
UseJPEGImageDecoder()
result=LoadImage(0,"bankwallwindow.jpg")
MessageRequester("",Str(result),0)
EndProcedure
;imagetest()
Did you try to do the Initialization of the the JPEG library in the
procedure?
Code: Select all
; This procedure is called once, when the program loads the library
; for the first time. All init stuffs can be done here (but not DirectX init)
;
ProcedureDLL AttachProcess(Instance)
EndProcedure
I tried this code, and it would not load. I am calling this from Blitz, BTW:
ProcedureDLL AttachProcess(Instance)
UseJPEGImageDecoder()
EndProcedure
ProcedureDLL ImageTest(a,b,c,d)
UseJPEGImageDecoder()
result=LoadImage(0,"bankwallwindow.jpg")
MessageRequester("",Str(result),0)
EndProcedure
;imagetest()
ProcedureDLL AttachProcess(Instance)
UseJPEGImageDecoder()
EndProcedure
ProcedureDLL ImageTest(a,b,c,d)
UseJPEGImageDecoder()
result=LoadImage(0,"bankwallwindow.jpg")
MessageRequester("",Str(result),0)
EndProcedure
;imagetest()
Delete the UseJPEGImageDecoder() from the ImageTest procedure. Works fine here.halo wrote:I tried this code, and it would not load. I am calling this from Blitz, BTW:
ProcedureDLL AttachProcess(Instance)
UseJPEGImageDecoder()
EndProcedure
ProcedureDLL ImageTest(a,b,c,d)
UseJPEGImageDecoder()
result=LoadImage(0,"bankwallwindow.jpg")
MessageRequester("",Str(result),0)
EndProcedure
;imagetest()
I think PB just doesn't work. Calling this empty DLL anywhere in the program causes the JPEG loader to fail:
ProcedureDLL.l CS_InitLightStatisticsWindow(hwnd,icon)
ProcedureReturn 0
EndProcedure
ProcedureDLL.l CS_ShowLightStatisticsWindow()
ProcedureReturn 0
EndProcedure
I ended up loading the images in Blitz, and then copying them pixel-by-pixel. It's a little slower, but it works alright.
ProcedureDLL.l CS_InitLightStatisticsWindow(hwnd,icon)
ProcedureReturn 0
EndProcedure
ProcedureDLL.l CS_ShowLightStatisticsWindow()
ProcedureReturn 0
EndProcedure
I ended up loading the images in Blitz, and then copying them pixel-by-pixel. It's a little slower, but it works alright.
I tried this, which should reproduce your troubles and it works for me.halo wrote:I think PB just doesn't work. Calling this empty DLL anywhere in the program causes the JPEG loader to fail:
ProcedureDLL.l CS_InitLightStatisticsWindow(hwnd,icon)
ProcedureReturn 0
EndProcedure
ProcedureDLL.l CS_ShowLightStatisticsWindow()
ProcedureReturn 0
EndProcedure
DLL1.DLL
Code: Select all
ProcedureDLL AttachProcess(Instance)
UseJPEGImageDecoder()
EndProcedure
ProcedureDLL ImageTest(a,b,c,d)
result=LoadImage(0,"C:\Dokumente und Einstellungen\A\Eigene Dateien\Eigene Bilder\limecat.jpg")
MessageRequester("",Str(result),0)
EndProcedureCode: Select all
ProcedureDLL.l CS_InitLightStatisticsWindow(hwnd,icon)
ProcedureReturn 0
EndProcedure
ProcedureDLL.l CS_ShowLightStatisticsWindow()
ProcedureReturn 0
EndProcedure
Code: Select all
If OpenLibrary(0,"E:\Daten\Sourcecodes\Test\dll1.dll")
If OpenLibrary(1,"E:\Daten\Sourcecodes\Test\dll2.dll")
Debug CallFunction(1,"CS_ShowLightStatisticsWindow",a,b)
Debug CallFunction(0, "ImageTest",a,b,c,d)
EndIf
EndIf1. You open a "bankwallwindow.jpg". Shouldn't that be "blankwallwindow.jpg"?
2. I am using absolute paths.
Anyway, do these 3 snippets work for you?

