Silverfrost Forums

Welcome to our forums

calling dll trouble

3 Mar 2009 2:08 #4352

Hello,

I'm trying to call a function from an external dll. However, I'm getting an Access violation error message. I'm using the Import libraries option in the project configuration dialogue box in Plato. The project compiles ok, but doesn't run. I'm doing something wrong but I don't know what!

Thanks

Albert

This is my code:

winapp

program test_metagif

C_EXTERNAL MetaGif 'MetaGif' ( val,val,val,val)
Integer,parameter :: w = 100, h = 100
call MetaGif('Temp\\gif001.wmf', 'Temp\\gif001.gif', w, h)

endprogram

This is the information I have about the function in the dll:

MetaGif

Declare Function MetaGif Lib 'METAGIF32.DLL' (ByVal inputFile As String, ByVal outputFile As String, ByVal scaleX As Long, ByVal scaleY As Long) As Long

Parameters

* inputFile - input file name (wmf/emf/bmp)
* outputFile - output file name (gif)
* scaleX - scale factor percentage (100 = width*1)
* scaleY - scale factor percentage (150 = height*1.5)
4 Mar 2009 8:15 #4353

My guess is that you will need

STDCALL MetaGif 'MetaGif' (instring,instring,val,val) 

at the very least but I am not sure that this will work.

4 Mar 2009 10:52 #4354

Thanks Paul, I eventually got it to work with the following. It works with .wmf files produced from other applications, but unfortunately not with .wmf files saved from simpleplot, which is what I need.... I think I've reached the end with simpleplot as it seems almost impossible to save images to disc without problems. I can't save an image to a bitmap from a %pl window, the resulting bitmap is size 1 pixel by 1 pixel. I can save a .wmf, but can't work further with this. The exercise here was a workaround for not being able to save bitmaps from a simpleplot window, the idea being to save as .wmf and then convert to .gif or .bmp with the function below, but this doesn't work either. Now where were those opengl demos....

winapp

program test_metagif

stdcall MetaGif 'MetaGif' (ref,ref,val,val) : integer*4
Integer, parameter :: w = 100, h = 100
integer::  r, MetaGif
r= MetaGif('C:\\gif001.wmf', 'C:\\gif001.gif', w, h )

endprogram 
Please login to reply.