Having fun with c10 and .net

Tags: #<Tag:0x00007f0b79300ad0> #<Tag:0x00007f0b79300a08> #<Tag:0x00007f0b79300940>

Yesterday i was wondering if a can use some clarion code in a new ASP.NET MVC5 project…

I do some basic step from a simple test.

  1. create a simple asp.net mvc project.

  2. Create a vanilla clarion exportable procedure with a few parameters (bstring, long) and pascal calling convention.

    The experimental procedure basically open a tps file (Customer file), do some clarion magic code and return the customer name…

  3. After that i prototype clarion procedure in .

  4. load the clarion dll using kernel32 loadLibrary…

  5. make a vanilla call to clarion code and it seems to work just fine.

  6. unload clarion dll using freelibrary

Now i was trying to do something more complex and now instead of opening a tps file i was opening a sql table (using MSSQL driver), do some clarion magic code (for testing purpose i was only doing a count over de table) and then close file…

All was fine until i call freelibrary in the net side…the programs hangs nothing else happen…

(maybe is something with MSSQL driver but it seems unprobably)
Dont know way and i am getting lost.

Any help? ideas?

Martin,
Take a look at AttachThreadToClarion procedure in the help.
When you call into a Clarion DLL from external non-clarion program that created the execution thread you need to attach the thread to Clarion’s runtime.

Rick

@Rick_UpperPark thanks,

yeah i know i was calling AttachThreadToClarion() before doing anythingelse, if i dont call it i get memory exception when the RTL is trying to open the files…

I copy the same code in C6.3 and its working just fine, really really strange .

Another idea?..

Can’t think of anything else.
Perhaps someone else will chime in.

Why not access SQL from the .Net side?

Rick

I would like to reuse some old clarion abc code…without having to rewrite it from scratch…

think i got no choices…

Perhaps @Mark_Sarson has an idea.
I know he has done a fair amount of interop work between .Net and Clarion.

Try prop:disconnect to make sure you have severed the connection between Clarion and the database.

1 Like

@PurpleEdge2214 yeap that did the trick…

It seems that de connection is still open when i try to freelibrary from the .net side

Thanks!