fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: SideBySide: X# DLL to use in VO

SideBySide: X# DLL to use in VO 1 year 9 months ago #2720

  ic2's Avatar Topic Author ic2 Offline Posts: 497
We want to replace our Vulcan DLL with a X# DLL, which means that we we have to go through the whole process again. This is how Vulcan program starts:

BEGIN NAMESPACE IC2VulcanMethods
[ClassInterface(ClassInterfaceType.AutoDual)];
[Guid("487BF093-A8F9-4119-82EB-414A78FCF342")] ;
[ComVisibleAttribute( TRUE )];
CLASS VoVulcanClass

When I do the same (with a freshly generated GUID) in the X# DLL, I get the following error:

Error XS9002 Parser: unexpected input 'CRLF', are you missing a closing ')' or '}' ? IC2ExtLibForVO D:\XSharpProjects\IC2ExtLibForVO\IC2ExtLibForVO\_StartData.prg 26

What should I change in X# to get this working?

Dick

PS: I saw I just posted subject 100. Does this entitle me for a price?

Please Log in or Create an account to join the conversation.

Last edit: by ic2.

SideBySide: X# DLL to use in VO 1 year 9 months ago #2721

  wriedmann's Avatar wriedmann Away Posts: 1573
Hi Dick,

this is code from my own (working) COM-Component:
[ComVisible(true)];
[Guid("EFCF1B80-9602-4282-A7F9-4CD3384484D4")];
[ClassInterface(ClassInterfaceType.None)];
[ProgId("EPPLusComponent.XlsxFile")];
public class XlsxFile implements IXlsxFile

and I need a
using System.Runtime.InteropServices

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

SideBySide: X# DLL to use in VO 1 year 9 months ago #2722

  Chris's Avatar Chris Offline Posts: 1179
Hi Dick,

The code as you posted it here is fine, it will not give any parser error messages. I suspect when you got this error, you had omitted one of the ";"s at the end of on of the attribute lines. Try a rebuild now, does the error go away? If not, at which line and col does it point?

btw, that was post #100 in the specific subcategory only. Maybe we can do something for subject #1000 overall (we're at 388 now) or at post #10,000 (2,693 now) :-)

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

SideBySide: X# DLL to use in VO 1 year 9 months ago #2724

  ic2's Avatar Topic Author ic2 Offline Posts: 497
Hello Chris, Wolfgang.

I knew it was only the 100th posting here ;)

I found the problem. It was an empty line between the code and the class. Removed it and it compiles. I will now try to finalize this (checking Wolfgangs remarks as well, I did not use the ProgId so far) and write a short summary if it works.

Dick

Please Log in or Create an account to join the conversation.

SideBySide: X# DLL to use in VO 1 year 9 months ago #2729

  ic2's Avatar Topic Author ic2 Offline Posts: 497
After the usual problems I got it working, this is what you have to do to call methods in a X# DLL (in my case it is C# and X# code) from VO without the need to Regasm the DLL"

What I did is this:
1 In the properties of the project, Build Events, Post-build I added this (first without the rem) (you may have to change the path to mt.exe):

rem "C:\Program Files (x86)\Windows Kits\10\bin\x64\mt.exe" -managedassemblyname:$(TargetFileName) -nodependency -out:$(ProjectDir)\$(ProjectName).manifest
"C:\Program Files (x86)\Windows Kits\10\bin\x64\mt.exe" -manifest "$(ProjectDir)\$(ProjectName).manifest" -outputresource:"$(TargetFileName)";2
Copy "$(TargetDir)*.dll" "c:\somewhere"

2 In the VO Manifest file, included in the exe, I started with the Appwiz\cctl6.man file, changed the program name and inserted

<dependency>
<dependentAssembly>
<assemblyIdentity name="IC2ExtLibForVO" version="1.0.65534.65534" processorArchitecture="msil"></assemblyIdentity>
</dependentAssembly>
</dependency>

Note that for the Vulcan DLL I wrote a few years ago I had to use processorArchitecture="*". For X# the program won't start, in the application log you'll find this error:

Activation context generation failed for "d:\XSharpVOTest\XSharpVOTest.DBG".Error in manifest or policy file "d:\XSharpVOTest\IC2ExtLibForVO.DLL" on line 1. Component identity found in manifest does not match the identity of the component requested. Reference is IC2ExtLibForVO,processorArchitecture="x86",version="1.0.65534.65534". Definition is IC2ExtLibForVO,processorArchitecture="msil",version="1.0.65534.65534". Please use sxstrace.exe for detailed diagnosis.

Apparently the DLL is supposed to be based on 'msil' (while I would say it's x86, see earlier discussions in this forum) - msil is introduced in VS 2015 and makes the OS chosoe between 32 and 64 bits I read.

3 I copied the DLL's generated (recompiled hem with REM in the first line which I remember was something which needed to be done for some reason) and then I could start the VO exe, and run methods from the DLL.

When I have this 100% ready I'll make a full descriptions for Examples.

Dick

Please Log in or Create an account to join the conversation.

SideBySide: X# DLL to use in VO 1 year 9 months ago #2733

  robert's Avatar robert Offline Posts: 1001
Dick,
One of the problem in your message has to do with automatic version number generating:
you are using the syntax to automatically generate a version number for your assembly
[assembly: AssemblyVersion("1.0.*")]

This will automatically generate the 3rd and 4th part of the version number.
Each time you recompile the version number will change !
For an assembly that implements a COM interface that is usually not a good idea. You may want to control the complete version number in your code.

Robert
XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1