After porting my library the first time and fixing the references (replacing the VulcanVO* libraries by the XSVO* libraries), I was really surprised how few errors I had:
- CompileErrors_Step1.png (96.56 KiB) Viewed 638 times
The 2 errors were only delegates added by xPorter:
Code: Select all
delegate DictClose_delegate() as void pascal
Easily changed to
Code: Select all
delegate DictClose_delegate() as void
and
Code: Select all
delegate EnumWindowsProc_delegate( hWnd as ptr, aWindows as array ) as word callback
to
Code: Select all
delegate EnumWindowsProc_delegate( hWnd as ptr, aWindows as array ) as word
These two issues will be fixed soon in xPorter.
Fixed these two, on the next compile the errors changed (with warnings hidden as I would concentrate on errors first):
- CompileErrors_Step2.png (17.25 KiB) Viewed 638 times
I will list every type of error only once - and all changes were made on both the VO and the X# side, so I had code synchronized. Larger changes were only made on the VO side, and then moved to X# with a new xPorter run.
Code: Select all
error XS0029: Cannot implicitly convert type 'Vulcan.Codeblock' to 'string'
in this part of code:
Code: Select all
if cValidBlock == NULL_STRING
cValidBlock := MCompile( cValidString )
endif
change to
Code: Select all
#ifndef __XSHARP__
if cValidBlock == NULL_STRING
cValidBlock := MCompile( cValidString )
endif
uResult := MExec( cValidBlock )
#else
if oValidBlock == null
oValidBlock := MCompile( cValidString )
endif
uResult := MExec( oValidBlock )
#endif
as MCompile has another definition in the Vulcan runtime. This correction fixed the first two errors.
Next error after recompile:
Code: Select all
error XS0619: 'Functions._RegisterExit(void*)' is obsolete: ''_RegisterExit()' is not supported. Use an event handler added to the AppDomain.CurrentDomain:ProcessExit event instead'
on this code part
Code: Select all
if lInit == false
#warning Callback function modified to use a DELEGATE by xPorter. Please review.
// _RegisterExit( @AxitGlobal() )
static local oAxitGlobalDelegate := AxitGlobal as AxitGlobal_Delegate
_RegisterExit( ;
System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(oAxitGlobalDelegate) )
lInit := true
endif
This code was changed by the xPorter, and since I don't think the .NET runtime needs the RegisterExit anymore, changed to:
Code: Select all
#ifndef __XSHARP__
if lInit == false
_RegisterExit( @AxitGlobal() )
lInit := true
endif
#endif
Next error:
Code: Select all
error XS0619: 'Functions.Buffer(dword)' is obsolete: ''Buffer()' is not supported, use MemAlloc() and MemFree() instead'
on
easily changed to
Code: Select all
#ifdef __XSHARP__
cBuffer := Space( 4096 )
#else
cBuffer := Buffer( 4096 )
#endif
The next error
Code: Select all
error XS9035: The first argument to PCall must be a 'typed function pointer'.
on
Code: Select all
PCall( ptrFunction, @strWinOsVersionInfo )
was changed to
Code: Select all
#ifdef __XSHARP__
PCallNative<int>( ptrFunction, @strWinOsVersionInfo )
#else
PCall( ptrFunction, @strWinOsVersionInfo )
#endif
Next series of errors:
Code: Select all
error XS0246: The type or namespace name '_GCDUMP' could not be found (are you missing a using directive or an assembly reference?)
in a function that dumped the current memory for diagnosis. Since the .NET garbage collector is totally, different, I decided to remove the entire function by adding an #ifndef __XSHARP__ before and a #endif after.
The same proceeding was used then on the error
Code: Select all
error XS0619: 'Functions.Memory(int)' is obsolete: ''Memory()' is not supported'
Next (and last error for this article):
Code: Select all
error XS0619: 'Functions._VOLoadLibrary(string)' is obsolete: ''_VOLoadLibrary()' is not supported, use VulcanLoadLibrary() instead.'
repeated several times on various dynamic loads of DLLs:
Code: Select all
hDLL := _VOLoadLibrary( cDLLName )
if hDLL == null_PTR
ErrBox( oWindow, StrTran( 'library %1 not found", "%1", cDLLName ) )
return false
else
hProc := GetProcAddress( hDLL, String2Psz( "CPPlusInitDLL" ) )
if hProc == null_ptr
ErrBox( oWindow, "error on initialization" =
return false
endif
PCall( hProc )
if IsClass( #ZipClass )
lRetCode := true
else
ErrBox( oWindow, "error on initialization of " + cDLLName )
return false
endif
endif
Since this code cannot work with X# as .NET works in a completely different manner, and DLLs are to be loaded with Reflection, I decided to not implement this for the moment, so my code was changed to:
Code: Select all
#ifdef __XSHARP__
ErrBox( oWindow, "error on initialization of " + cDLLName )
return false // TODO
#else
... remainder of code
#endif